Ingeniero en sistemas
the lifecycle of a request in ASP.NET MVC
by Simone Chiaretta
Incoming request
Controller Creation
You are not going to enter the MVC pipeline, you are on your own nowMvcHandler
Custom
3
MvcRouteHandler DependencyResolver finds and create instance of Controller
What type of IRouteHandler ?
Controller Factory
Routing
2
Evaluate requested URL againstroute Definition (including iRouteConstraint)
is the route valid? Yes IRouteHandler Controller No ControllerActionInvoker ActionInvoker Custom You are getting out of the default MVC workflow. Youhave to handle action and result execution by yourself
Action Execution
Select next route
1
The response is returned to the browser
Action to execute is chosen based on name viaActionNameSelectorAttrlbute
4
Action to execute is chosen based on other logic via ActionMethodSelectorAttrlbute
Result Execution
Result Filters (OnResultExecuted ) are executed IValidateObject ModelBinder de-serializes parameters Validation logic
View rendering
Model Validation Provider Retrieves validation rules Validation rules
Model Binder validates parameters
5
AuthorizationFilters
are executed
Html Helper, AjaxHelper , UrIHelper generate needed HTML code
Validation rules
ActionResult custom execution
Javascript validation logic is added
11
ModelValidation Provider Retrieves model visualization info
is authorized?
Filters
Yes
HtmlHelper Templated Helper renders HTML of forms
Validation rules
6
Action Filters (OnActlonExecuting )are executed
DependencyResolver finds and create instance of Filters Filters
IFilterProvlder finds filters applied to Action
template TemplateHelper templates No
IView
10
Executionstopped?
DependencyResolver finds and create instance of I View
All IVIewEngine registered are probed to find the view to render
9
Yes
No Filters
Action parameters are filled with...
Regístrate para leer el documento completo.