MIX08- Developing ASP.NET Applications Using the Model View Controller Pattern.

http://www.hanselman.com

scotths@microsoft.com

  • New web project type for asp.net
  • More control over your </html>
  • Testable framework
  • Not for everyone

Master Cheif GU!

.NET 3.5 MVC web application template.

Options:

  • Enable testing right out the gate. NVUnit or any Unit.
  • No testing option

System.Web.MVC  System.Web.Extension System.Web.Routing [Namespace]

Controllers Models and Views

   Controller is a base class Index and about public class's {controller/action}  Direct relationship.

Flexible Fundamental, Plays well with others, Dry or Simple don't repeat yourself.

 

Clean Separation of Concerns

  •     Easy Testing
  •     Red/Green TDD
  •     Highly maintainable applications by default

Extensible and Pluggable

  •    Support replacing any component of the system

Driving Goals:

Enable clean URLS and HTML

   -SEO and REST freindly URL structures

Great integration within ASP.NET

MVP vs. MVC

Presenter: Up front presentation

Controller: Component

AJAX with MVC? Cannot Drag the ajax controls to the page.

-AJAX can be used but all code behind.

MVC RTM: When Duke Nukem Forever comes out.

 

Security: Is it safe? Same as ASP.NET!

Performance/Scalability Only as good as you write it.

MVC what is it?

  • Browser requests /Products/
  • Route is determined
  • Controller is activated
  • Method on Controller is invoke
  • Controller does some stuff
  • Renders View, passing in custom ViewData
  • URLs are rendered, pointing to other Controllers

Request->HTTP Routing->Route->Route Handler->Http Handler-> Controller-> View Engine-> View-> Response

Clean code!

URL Routing Pretty URIs -Developer adds routes to a global RouteTable -Mapping creates a RouteData -a bag of key/values

Route Testing for URLs Very SEO friendly.

Views

Controllers

Models

Routes

are all Pluggable

ViewEngineBase

   View Engine render output

    You get WebForms by default

Implement your own.

  •   MVCContrib Brail Nvelocity
  • NHaml

View Engines can be used to offer new DSLs to make Html easier.

Making Microformats.

 

<% { %>

code between

<%}%>

Mockable Intrinsics:

HttpContextBase, HttpResponseBase, HttpRequestBase

Extensibility:

IController, IControllerFactory, IRouteHandler,ViewEngineBase

RhinoMocks or TypeMock

Create Tests of the runtime.

For loop on front end?

 

No Comments