mvc controller architecture deep dive. holistic look where do controllers fit?
TRANSCRIPT
Simple Application
• A web site• Abstraction costs higher than return• Does not integrate with business
processes• Solo project
Layered Application
• More thought placed in design• Integrates into larger infrastructures• Abstraction necessary for reuse• Team project
Layered Application
Workflow Component Model
Business Layer
DAL Component Gateway
Data Access Layer
ControllerViewViewModel
Presentation LayerCrosscutti
ng Concerns
Enterprise Application
• Complexity determined by business needs– But strive for simplicity• And reusability
• Will integrate into larger infrastructure
Enterprise Application
DB
Workflow ServiceData
Service
Business Service
WPF AppConsole
App Web App
This is reduced…
Public Service
Breaking It Up
Workflow Component Model
Business Layer
DAL Component Gateway
Data Access Layer
ControllerViewViewModel
Presentation LayerCrosscutti
ng Concerns
Considerations
• Flexibility• Maintainability• Related entities• Are you using more than one
repository per controller?
Action Results
• Controllers do something when called• Standard action results– ViewResult– JsonResult– ContentResult– EmptyResult– FileResult– HttpUnauthorizedResult
Action Results
• More Standard actions– JavaScriptResult– RedirectResult– RedirectToRouteResult
• Make your own!
Standard Controllers
• Great for standard web applications• Convention-based– Even non-standard controllers are
convention based when used with views
Custom Controllers
• Can decorate the standard class• Can inherit from ControllerBase• Can implement IController• Use for non-standard applications– or for more control
Controller as a Service
• MVC apps are typically web sites• They can also be web services• Do you have a mixed site/service?• It can also be a pure service without
JSON
ResourcesSoftware Application
Developers
http://msdn.microsoft.com/
Infrastructure Professionals
http://technet.microsoft.com/
msdnindia technetindia @msdnindia @technetindia
© 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and
Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.