Click here to Skip to main content
15,867,704 members
Articles / MVC

The Circle of Life…Cycle of MVC Applications

Rate me:
Please Sign up or sign in to vote.
4.67/5 (2 votes)
18 Jun 2014CPOL2 min read 11.9K   7   2
The circle of life... cycle of MVC applications

MVC-Lifecycle

One of the common challenges for developers migrating from the Web Forms environment to MVC is learning how to adjust to a different application life-cycle. Web Forms had a very well defined chain of events that would be triggered prior to a page being rendered, however the lines aren’t as clear within MVC.

Earlier this month, I stumbled upon the following document from Cephas Lin provided both a high-level overview and a detailed view of the general life-cycle within an MVC application and I thought I would share it :

MVC Lifecycle

Basically the life-cycle, it could be summarized (very simply) as follows:

  1. The application is started (through Application_Start) and the appropriate Routes are wired up and configured.
  2. An HTTP Request comes in and MVC takes over.
  3. Your Controller that corresponds to that Route will be created, instantiated and any authorization filtering will be handled (if failed it will send back a failed request).
  4. Any model binding will occur from the Request to any parameters to populate your values.
  5. The logic of your Action will be executed as expected and it will find a View that corresponds to the one specified in the Action and pass it the appropriate Model.
  6. The Model will populate the View and it will be served to the user.
  7. The Result will be executed and the Controller will be disposed of.

This is a very generalized summary (it doesn’t go into detail about ActionFilters, etc.). Hopefully, it might help developers that are just migrating to MVC better understand what is going on behind the scenes.

If you wanted a more detailed exploration of it, I would recommend reviewing over the detailed view of the document above and checking out the following other related resources:


Filed under: CodeProject, Development
Image 3 Image 4 Image 5 Image 6 Image 7 Image 8 Image 9 Image 10

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United States United States
An experienced Software Developer and Graphic Designer with an extensive knowledge of object-oriented programming, software architecture, design methodologies and database design principles. Specializing in Microsoft Technologies and focused on leveraging a strong technical background and a creative skill-set to create meaningful and successful applications.

Well versed in all aspects of the software development life-cycle and passionate about embracing emerging development technologies and standards, building intuitive interfaces and providing clean, maintainable solutions for even the most complex of problems.

Comments and Discussions

 
QuestionThanks - Great diagram! Pin
devvvy1-Jul-14 13:27
devvvy1-Jul-14 13:27 
QuestionTip, not Article Pin
Adyh22-Jun-14 19:25
professionalAdyh22-Jun-14 19:25 
You should probably change this to "tips" since it doesn't qualify as an article. Other than that, good summary. To most developers it's probably enough.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.