MVC Basics, Advantages and request life cycle

MVC Introduction

  MVC stands for Model-View-Controller. Asp.net MVC is a new web application framework from microsoft. In MVC there will be no dealing with pages and controls, post backs or viewstate.

  Mainly in MVC the application will be divided into three main component roles Models, Views and Controllers.

Model :

       A model can be used to pass data from controller to view
       A model is accessible by both controller and view.
       A view can use model to display data in page.

View:

View is an ASPX page without having a code behind file
A request to view (ASPX page) can be made only from a controller’s action method

Controller:

Controller is basically a C# or VB.NET class which inherits system.mvc.controller
Controller is a heart of the entire MVC architecture
Inside Controller’s class action methods can be implemented which are responsible for      responding to browser OR calling views.
Controller uses ViewData to pass any data to view

MVC Advantages:

  Separation of concern – easier to manage application complexity through model, view, controllers

  TDD – Test driven development

  Viewstate will not be used in mvc

  Asp.net features will be supported like authentication, authorization membership caching session

  URL routing mechanism

  MVC Request Life cycle:

The life cycle will be in the below process

 Browser → Routing → controller-> Action → View

0 comments:

Post a Comment

Vikram Chandra Theme by BloggerThemes & NewWPThemes Sponsored by iBlogtoBlog