Introduction to Asp.Net MVC

Asp.Net MVC Framework Introduction:

What is MVC?

The Model-view-controller (MVC) is an architectural pattern framework developed by Microsoft that is  an alternative to web forms for creating the web application.  The MVC Pattern separate the application in three main components   : Model, View and Controller. Each component perform the specific task. The MVC framework is a lightweight and testable framework that also support the existing features like authentication, master pages etc.

Components of MVC:

An Asp.Net MVC Project mainly contain three components.
·         Model
·         View
·         Controller


The model represent  the business logic and data of the application.  This can represent the data that is being transferred between the View and Controller components or data that is related to any other business logic .  Generally model is used to store and retrieve the data from database.


View is representation level of project. The View is responsible displaying data and transforming Model or Models to visual representation. Views are generally created from model data.


Controller is just like the heart of any application. Controllers act as an interface between Model and View components to process all the business logic and incoming requests. The controller takes input from views and interact with model and return the result to the view.

Features of using the Asp.Net MVC:

·         MVC pattern is ideal for developing the light weight and complex application.
·         MVC provide the isolation b/w codes because MVC components are divided in three parts(Model, View and Controller) that are always isolated to each other.
·         It doesn’t use the View State for controls that make it suitable for light weight application.
·         The MVC components are not directly depend on each other this make it easy to test components separately.
·         Supports all the existing concept of  ASP.NET functionalities such as Authorization, Authentication, Master Pages, Data Binding, User Controls, ASP.NET Routing, etc.
·         Asp.Net MVC use the HTML helpers, these HTML helpers are just like the server  controls of Asp.Net but doesn’t contain the View state that make them very light weight. We can also generate our custom helpers.
·         Generally developers spent  their time in writing the code for the same Create, Read, Update and Delete operations on data entities. Asp.Net MVC provide the scaffold templates that reduce the efforts of developers.
·         Asp.Net MVC also supports the template feature , that allows you to create a shared partial view and use the same on different other views.
·         Asp.Net MVC supports data annotation attributes which are used for data validation purpose.

When to use Asp.Net MVC:

Before the Asp.Net MVC, Webfoms are used to develop the application. We know that Webforms use the server controller and these server controllers use the view state to maintain the state of application that makes it very heavy process for development. But Asp.Net MVC doesn’t use any view state, that makes it light weight . If we want to develop application which should be lightweight and easy for testing and Maintenance and more Loose Coupling that time we can develop application in MVC.  


Post a Comment

Online Casino