DevDays – MVC – Scott Hanselman video:
WFT1_2MB_ch9.wmv 1.4GB
Looking at the callstack in debug to see how things are called.
IHttpHandler – the ‘simple’ building block of ASP.NET.
Example in c:\code\mvc2\hanselman
http://localhost:1476/Home/poop/2
Controller get invoked
Action invoker calls the method
Model Binding – took the other piece of the route data (ie 2) and coerced it into…
didn’t call HttpRequest or anything..
Passing a DateTime
Phil Haack Route Debugger
http://haacked.com/archive/2008/03/13/url-routing-debugger.aspx
prop tab tab to auto gen the properties. then tab tab, then enter enter!
Create A Controller
Ctrl M, Ctrl C
Convention is HomeController
var p = new person
then ctrl period to import the namespace.
Create A View
Convention is in Views directory, create a new Person directory.
Index method links to Index view
Details method links to details view.
Ctrl M Ctrl V to create a view, when you are in the appropriate Controller class (eg Index)
Created a strongly typed view.. this Viewpage is of type Person
Model in the viewpage will always be of type T ie Person.
Could use Repository Pattern for the DB
Going live with ASP.NET4 – many hosting providers need you to upgrade to another machine.
Going Live on Azure
Created a new MVC2 Web Role project
Upload to test that MVC2 is working somewhat
ViewModel - MVCMusicStore
VS2010 Control comma – navigate to
http://mvcmusicstore.codeplex.com/
Uses Entity Framework.
Uses <%: HTml.DisplayForModel
AutoMapper
FirstName, LastName.. map to FirstName and Surname
ViewData
is another way to pass data.
ViewEngines
This is the WebForms view engine.
Routing
NerdDinner – MVC2 in beta (now it is live 27th May)
there are unit test in here.
just asserting not null.
Seperation of Concerns – in controller we can’t have Response.Write.. as it would break in this test. Would work at runtime.