ASP.NET MVC Pipeline And Extensibility
ASP.NET MVC is designed with extensibility in mind and almost every part of processing pipeline is extensible using your own providers to replace the standard implementation. Simone Chiaretta, in his blog post “An Introduction to ASP.NET MVC Extensibility” gives an introduction to various stages in the ASP.NET MVC Pipeline, and a brief explanation of how extensibility comes into picture.
The ASP.NET MVC Pipeline can be divided into the following parts -
- Routing Part – Routing module tries to match the incoming URL with the routing table, and calling the corresponding IRouteHandler.
- Controller creation – the IControllerFactory creates an instance of the controller based on route parameters and default naming conventions.
- Action Execution – the IActionInvoker identifies the method to be executed, the IModelBinder validates and binds the method parameters and the IFilterProvider discovers filters to be applied. The Action returns a type ActionResult.
- View – the IViewEngine instantiates the correct view engine and the model is passed to the view. Using Model Validation Provider, the validation rules are retrieved to create client-side validation scripts as well as remote validation scripts
Every interface in the above pipeline can be implemented as a custom provider to replace the default implementation, using extensibility. Simone explains the different types of extensions, based on their purpose, and promises to cover each of these in more detail in subsequent articles -
- Essentials – custom templates, server and client side validations and HTML helpers
- Productivity enhancers – base controller with new conventions, AJAX helpers, URL helpers, Action/Result Filters
- Case Specific – for solving specific problems – route constraint, route handler, Action result, model binder and ActionMethodSelector
- Core Extensions – Controller Factory, Action Invoker, View Engine, Model Validation Provider, Model Metadata Provider
Do checkout the article for a much more detailed explanation.
ASP.NET MVC (Model-View-Controller) is a patterns based way to build dynamic websites in ASP.NET, as an alternative to the event-driven web-forms. It helps in clear separation of concerns and gives full control over the html markup.
Yoni Goldberg Oct 30, 2014
Dmytro Svarytsevych Oct 30, 2014