ASP.Net MVC Overview

ASP.Net MVC is a web application framework, that gives you a powerful MVC architecture based way to build dynamic web applications, enables a clean separation of concerns and gives you full control over markup.
To overcome the problems associated with ASP.Net Web Forms , Microsoft instroduced ASP.Net MVC in 2009.

Main Advantages:
1.Clean separation of concern
We can develop and test model, view & controller separately. Different teams can develop these independently.

2.Faster Performance than ASP.Net Web Forms
In ASP.Net MVC, server controls are eliminated. The design of MVC does not require any server control.So Page life cycle and view state processing related to server controls are not required now.

3.Supports unit testing
Unit testing is the concept of testing a smallest piece of code independently whether it is returning expected result or not. You can test controllers and business layer separately in ASP.Net MVC.

4. Supports Dependency Injection
Dependency injection is the concept of loading business objects dynamically in to controller rather than at compilation time. Controller can have reference
variables that holds reference of business objects.Controller can have multiple business objects e.g. one for dealing with file storage and another one dealing with database storage but controller does not know which business object will be stored in reference variables.We can configure in configuration file so that framework can creates business objects and inject the same business object in the reference variables, so loading the business objects in reference variables that are present in controller at run time is called dependency injection.

Asp.Net MVC is alternative of ASP.Net Web Forms. Asp.Net MVC provides clean and clear way of developing dynamic web applications based on real stateless nature of http protocols. ASp.Net MVC is part of ASP.Net. It is not isolated from ASP.Net. 
ASP.Net has 2 major parts: Asp.Net Web Forms and ASS.Net MVC.
Apart from these ASP.Net Web API is also part of ASP.Net.

MVC is an architectural pattern that dictates you to write application code as composition of 3 major parts.

3 Major Parts of MVC Application:
1.Model
2.View
3.Controller

Model
Model contains data structure and business logic. It is c# class which represents an entity. It has properties and methods similar to any c# class.

View
It contains presentation logic to display the Model.View reads properties of Model class and display it on UI. View contains html, css, javascript and c# code to render the output.

Controller
Controller defines execution flow. In MVC architecture view or model can not execute upon receiving a request. When request is sent then first controller executes after that controller calls model that means controller creates a model object then controller calls the view and passes model object to the view, view reads necessary properties from model object. While view is reading the properties of model, controller is not involved.

1 thought on “ASP.Net MVC Overview”

Leave a Comment

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