1 / 13

Asp.Net MVC

Asp.Net MVC. Adnan Masood Jeff Bergman Sean Xiao. Why MVC?. Very Clean separation of Concerns Unit Testing Model that leads you down a maintainable path (prevent crappy code) Clean Urls and Html. Front Controller. Classic asp.net framework is Page Controller

fern
Télécharger la présentation

Asp.Net MVC

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Asp.Net MVC Adnan Masood Jeff Bergman Sean Xiao

  2. Why MVC? • Very Clean separation of Concerns • Unit Testing • Model that leads you down a maintainable path (prevent crappy code) • Clean Urls and Html

  3. Front Controller • Classic asp.net framework is Page Controller • Map Urls to classes/controllers instead of Pages

  4. Unit Testing • Mock Objects to simulate responses. • Don’t have to go through a page or view • Red/Green Testing

  5. Features • Routing • Controller • View • Dependency Injection • Pluggable • Interfaces for all core contracts

  6. Urls • Url no longer points to the view/aspx page • A Url maps to a controller class • Allows more flexibility to map Urls • Url routing engine, Route table • Routes are tokenized strings • Can use RegEx

  7. Route Examples • <Controller>/<Action>/<Param> • http://domain/Home/CustomerDetail/45 • Html.Link for creating outbound urls • Html.Link(<Friendly Name>, <Action>, <Controller>)

  8. Controller • IController • Execute(IHttpContext ctx, RouteData routeDate) • class MyController : Controller • [ControllerAction] attribute

  9. Unit Testing • Create instance of controller • controller.ViewEngine = new TestViewEngine(); • Uses Mock Objects

  10. View • Similar to existing page • No postback or view state • Not all page events will fire • Editing forms will be more work • Separate page for viewing, editing, and updating • Ajax will use UserControls as update panels but request still goes through the control

  11. View • View probably shouldn’t directly access data sources or services. • Use the ViewData which stores the model the view is rendering • ViewPage<T>, ViewPage

  12. Future of Asp.Net • MVC for the Enterprise • Classic Asp.Net for quicker implementations

  13. Thanks For Coming! • PRIZES!!!! • Don’t forget we draw prizes on Sunday afternoon, including great products like Acronis and CodeSmith Tools, plus many new books! • THANKS AGAIN TO OUR CONTRIBUTORS!!!! • Cal State Fullerton (http://www.fullerton.edu) • Spherion (www.spherion.com) • Microsoft (www.microsoft.com) • Neudesic (www.neudesic.com) • PDSA Inc. (www.pdsa.com) • QuickStart (www.quickstart.com) • Harbor Objects (www.harborobjects.com) • Odyssey Consulting Group (www.ocgpros.com) • IDesign Inc. (www.idesign.net)

More Related