Click here to Skip to main content
Click here to Skip to main content

Tagged as

The Circle of Life…cycle of MVC Applications

, 18 Jun 2014
Rate this:
Please Sign up or sign in to vote.
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 cle

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 cooresponds 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

License

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

Share

About the Author

Rion Williams
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.
Follow on   Twitter

Comments and Discussions

 
QuestionThanks - Great diagram! Pinmemberdevvvy1-Jul-14 13:27 
QuestionTip, not Article PinprofessionalAdyh22-Jun-14 19:25 

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

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

| Advertise | Privacy | Mobile
Web04 | 2.8.140827.1 | Last Updated 18 Jun 2014
Article Copyright 2014 by Rion Williams
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid