MVC Architecture

The MVC architectural pattern has existed for a long time in software engineering. All most all languages use MVC with slight variation, but conceptually it remains the same.

Let’s understand the MVC architecture supported in ASP.NET.

MVC Architecture

This article will describe the ASP .Net MVC architecture. We already discussed the basics of the MVC framework.

Please read MVC Framework Introduction

Model

  • It is one main component in MVC framework.
  • Application data and behaviour in terms of its problem domain and independent of the UI.
  • In other word it is data represent layer in MVC framework that mean It can able to handle data between View and Controller.

Controller

  • It is another main component in MVC framework.
  • Responsible for handing an HTTP request.
  • It can able to process the all business logic, manipulating the data and respond to incoming request.
  • It is worked bridge between Model and Controller.

View

  • It is last main component in MVC framework.
  • It is the user interface layer in MVC framework.
  • the HTML markup that we display to the user.
  • This component contains UI logic of application such as from details, form component details etc.
MVC Architecture
MVC Architecture

The above topic such as Model, View and Controller, we already discussed in our MVC framework introduction part.
On the above MVC Architecture image, the User is sent a request to the MVC application. The user entered a URL in a browser. URL has requested a controller. The controller is called a model or a view depending on the request. Model is passed to the respective view. The view renders the HTML code. Finally, the user can able see the view.
Here, How can URL come to know appropriate? or  How MVC framework can able to handle the new user request?

Please read SQL Server Tutorial

Now I will share with you another major component of MVC framework.

Microsoft had introduced a Routing mechanism on MVC 1 and above. We will discuss the new concept “Router” of MVC Framework.

Router

  • Microsoft had introduced Routing mechanism on MVC 1 and above.
  • Select the right controller to handle a request.
  • ASP.NET introduced Routing for mapping each URL with a physical file.
  • Router is the process of an URL to a controller and depend upon configuration time.
  • This process is implemented in System.Web.Routing.
  • Routing configured in RouteConfig.cs file.

MVC Architecture with Route

MVC Architecture
MVC Architecture

Step 1 
The user sends a request to the MVC Application through a browser.

Step 2 
Global.ascx receives the user request and starts the routing depends upon the incoming URL request using the RouteTable, URL RoutingModule and MVCRouteHandler.

Step 3
Routing operation calls the respective controller and executes it.

Step 4
The controller processes the data using a model and invokes the respective view.
Step 5 
Model is passed to the view.

Step 6
View renders the output in markup format.

Leave a Comment

Your email address will not be published. Required fields are marked *