Thank you everyone who came to my one day ASP.NET MVC workshop at ASP.NET Connections. We managed to build an entire Movie Database application with unit tests and a reasonably good design — Congratulations!
I’ve attached the Movie Database application and the demo code from the workshop below.
drgrgfdg
So, this just follows the same principles as the contact manager you posted on asp.net/mvc.
I appreciate your work, however, I would like to request you use a different testing framework. MSTest is only available for VS Pro and Team. Something like nUnit would be nicer for us 2008 express edition users.
Thanks.
@Jacob – Yes, it has the same architecture as the Contact Manager application — when I find something that works, I stick with it 🙂
Good point about NUnit for Visual Web Developers. Thanks.
hi Stephen,
For 2 to 3 month, i am reading regarding ASP.net MVC Framework and also integrated it in my some intranet applications, it is awesome, it is solving alots of issues that i have faced in WebForm but i am also a big fain of WCSF, mainly it’s plug able architecture.
We are designing a VOIP Exchange System that will work on Internet. For its web development, i had plan for WCSF but after designing some interanet application on ASP.NET MVC framework, i am thinking to desing my VOIP application using MVC but i need that plugable architecture.
I were thinking to replace the MVP with MVC in WCSF but my team don’t have that much time.
please advise me what should i do?
I really like ASP.Net MVC for more than one reasons but there’s just one thing that keeps me from using it, I just cannot figure out how to do the following…
All the tutorials I’ve found so far are based on a one-to-one model: list products, display one product, edit, create, delete… Same for your movie app.
What I would like to do is to display a blog entry in a view, followed by the comments associated to it (different model), and then followed by a form to post a new comment, while using the same default validation codes (Html.ValidationMessage…) which are created automatically.
I just can’t figure out how to achieve this as it always complains about the model not fitting the view (excuse my french…). So a tutorial replicating this example or some guidelines would be very much appreciated! 🙂
Thanks for all your hard work!
@Francis: I’ve done that by creating a class that aggregates model objects and using that as the Model for the view. So if you needed to pass both a PostCollection and a CommentsCollection (or whatever), those would be properties on this third class…whatever you call it. Has worked great for me.
@Francis, @Eric — Yes, you want to create a view model class that exposes both properties. Then, use the following Inherits attribute at the top of your view:
Inherits=”System.Web.Mvc.ViewPage“
There is a sample of this in the workshop code if you take a look at the ViewsMovieIndex.aspx view.
Thanks a lot!! I’ll go study that. Nice! 🙂
I have viewed some examples but all of them have prerequities : using specific technologies(LinkToSQL .. and so on). Can you give ASP.NET MVC examples using well known and simple things like classic ADO databases manipulation. This will help many peoples.
For example: How to construct an ASP.NET MVC application with this 3 things:
1.A pure HTML/Javascript Form page with HTML input text tags for each field (say Customer.html of Notrhwind.mdb)
The page have 2 buttons: NextRecord and PreviousRecord having at Onclick_Event:getRecord(NextOrPrevious)
2.A javascript manual ajax GetRecord function, something like this:
function getrecord(NextOrPrevious) {
var oXMLHTTP = new ActiveXObject(“Microsoft.XMLHTTP”);
var sURL = “getrecord.aspx?ID=” + NextOrPrevious;
oXMLHTTP.open( “POST”, sURL, false );
oXMLHTTP.send();
var sResult=oXMLHTTP.responseText
var aRecord = sResult.split(“;”);
document.getElementById(‘CustomerID’).value = aRecord[0];
document.getElementById(‘CompanyName’).value = aRecord[1];
document.getElementById(‘ContactName’).value = aRecord[2];
document.getElementById(‘Adress’).value = aRecord[3];
… and so on …
}
3. What is the SHORTEST and the simpliest way to program getrecord.aspx ? or VB/C# getrecord controler function ? using something like ADODB Recordset. VB/C# GetRecord function will return a simple string containing the current record fields values separated by comma. (but without using other things like LinkToSQL, views, models , Json, XMl, or other entities.)
Think you very much !
Thanks a lot!
Your sessions were great Stephen. I really enjoyed them. I stayed the extra day for the MVC workshop and was glad that I did. I am NOT sold on the Entity Framework and I am disappointed with the inherent support for JavaScript in MVC but this framework seems to be right up my alley. Thanks again.
Are there any places where I can watch it? like MIX09 or PDC? Or this is just a “private” conference, in the sense that it’s not been published on the net?
@timur: Here
http://www.asp.net/learn/mvc-videos/video-395.aspx
Hi Stephen,
Is it possible at your side to send me a step-by step guide on the Movie App so that I can practice at my free time? Thank you.
The code is of high quality, We can learn a lot from it!
@Alex — There is both a written and video version of the Movie Application tutorial at http://www.ASP.net/mvc
I have a question about the design gallery. Why is that the master page references a code behind file? And where is it? It seems the layout blows in the face of MVC a bit or am I looking at it incorrectly. thank you. -E
@Eric — Several of the designs in the Design Gallery are currently outdated because they were created while ASP.NET MVC was in BETA. We are planning on updating all of the designs to work with the final release of ASP.NET MVC within the next two weeks.
Please let me know whether i could find the code in vb.net too.
Thanks
What is the purpose of the Service Class – why are you adding an extra layer. Also, how would one change datastore? Say I am using MSSQL now and in the future decide to use XML instead, how and where would I do this? It was v easy in the Provider Model. Sorry but new to this Repository Pattern stuff.
@Eb – According to the Single Reponsibility Principle (SRP) a class should have a single reason to change. You don’t want to mix validation logic with your controller logic and data access logic. In the sample application, the controller logic is in the controllers, the validation logic is in the service, and the data access logic is in the repository.
Because classes that interact with the repository interact only with the IRepository interface, you can easily swap a new repository for the existing one. Just implement the IRepository interface with the new class.
Hope this helps!
Stephen
Thanks for your instant reply (you are good!!). OK get you bit about validation logic. I am still confused about plugging in various datastore. Only way I can think of changing repository is probably by loading Repository type via some configuration section in the Web.Config (like loading default provider in the Provider Model). Also, I think the type can be loaded via Global.asax.
Please clarify – thanks
@Eb — Yes, that’s right. If you don’t want to hard code the repository then you can (a) Use something like the provider model (b) Set the repository in the Global.asax (c) Use a Dependency Injection Framework like the Microsoft Managed Extensibility Framework(MEF).
Stephen,
Nice and simple video/tutorial.
I followed the instructions to remove the id field from the Edit view by removing the following code:
< %= Html.TextBox("CampaignId", Model.CampaignId) %>
< %= Html.ValidationMessage("CampaignId", "*") %>
and now I am receiving a NullReferenceException on the Model object in the next field of the Edit view:
< %= Html.TextBox("CampaignName", Model.CampaignName) %>
< %= Html.ValidationMessage("CampaignName", "*") %>
What is causing the Model object to be null if the id is not present?
Thanks!
The HTML code was removed in the above. This is the line of code in the view where the Model object is null:
Html.TextBox(“CampaignName”, Model.CampaignName)
Is removing the id field from the Edit view causing the Entity Framework not to populate the Model?
Thanks – loving MVC but not a lot of code around at the moment, so this is great…
Thanks for sharing. Nice to have source code available
Very good example is given in attachment. I understand that very well. Thanks.
Thanks for this nice code.
wer Very good example is given in attachment. I understand that very well. Thanks.
i like this post thanks!!!
wer Very good example is given in attachment. I understand that very well. Thanks.
I understand that very well. Thanks.
GED Online | High School Diploma
This is the line of code in the view where the Model object is null.
homeschool online
I must say, very interesting and helpful article.
Very good example is given in attachment. I understand that very well.
Nice info!
MSTest is only available for VS Pro and Team. Something like nUnit would be nicer for us 2008 express edition users.
Very good example is given in attachment.
Research Paper| Researchpaper| Research Paper Writing| Research Paper Help| Custom Research Paper|
Nice info!
Online Research Paper| Buy Research Paper| Research Papers| UK Research Paper|
Nice article, very helpful. Thanks!
——————————–
Nike Shoes || air yeezy
gerr
Franklyn movie download
Fred Claus movie download
Friday Night Lights movie download
Friday the 13th movie download
Hello
Stephen your posts are always useful. Thanks for sharing.
selam hi This sounds fascinating sıcak sohbet I’m going to read that tracing articlekısa aşk şiirleri when I have a moment.
Wow. erotik film izle is
şifalı bitkiler zayıflama de
çet sohbet fer
netlog ger
müzik dinle err
şarkı dinle
cüneyt arkın filmleri kk
isyan sözleri fer
hikayeler er
islami çet
escort bayanlar der
bedava chat dd
chat odaları der
liseli kızlar derf
kızlarla sohbet fder
kızlarla chat
sohbet errDD
Is removing the id field from the Edit view causing the Entity Framework not to populate the Model?
Tiffany Jewellery | Ed Hardy | Tiffany Jewelry