MVC Meaning – Model View Controller. It is a software design pattern which forces a separation of concerns. Thus domain model and the controller are decoupled from the user interface. It makes the application built using MVC design pattern very easy to maintain and testing is also very simple and easy.
ASP .Net MVC is a framework that follows that design pattern to develop web application. It is built on top of the Microsoft .Net Framework. It provides us with the clean separation of the code.
MVC design pattern
MVC design pattern is divided into three parts: Model, View and Controller
Model – All the business logic classes are stored in that part of the MVC design Pattern. All the business rules are defined in this part, from these rules our application knows that how to manipulate data stored in the database. By default, models are stored in the Models folder of an ASP.NET MVC application.
View – The View is responsible for user interface. All the UI elements like CSS, jQuery and HTML etc. are comes in this part of the MVC. It receives the data from the controller and shows it using user interface components. The view is only responsible for displaying the data that is received from the controller as a result. By default, views are stored in the Views folder of an ASP.NET MVC application.
Controller – The controller process the request. It receives the input from the user through View, and then it process the data with the help of model and sends back to the View to show it to the user. We can say that it is a bridge between View and the Model. By default, controllers are stored in the Controllers folder an ASP.NET MVC application.
Communication between Model, View and Controller:
- User interacts with the Controller.
- There is one-to-many relationship between Controller and View means one controller can mapped to multiple views.
- Controller and View can make call to model.
- Controller and View can talk to each other.
- Model and View cannot talk to each other directly. They communicate to each other with the help of controller.
Advantages of ASP.NET MVC
Separation of concern
MVC design pattern divides the ASP.NET MVC application into three main aspects Model, View and Controller which make it easier to manage the application complexity.
Better support for test-driven development.
Extensible and pluggable
MVC framework components can be replaced or customized easier then Web Forms.
Full control over application behavior
MVC framework doesn’t use View State or server based forms like Web Forms. This gives the developer more control over the behaviors of the application and also reduces the bandwidth of requests to the server.
ASP.NET features are supported
MVC framework is built on top of ASP.NET and therefore can use most of the features that ASP.NET include such as the providers, authentication and authorization, membership and roles, caching, session and more.
URL routing mechanism
MVC framework supports a powerful URL routing mechanism that helps to build a more comprehensible and searchable URLs in your application. This mechanism helps to the application to be more addressable from the eyes of search engines and clients and can help in search engine optimization.
History of ASP.NET MVC Framework with theirs features.
- Released on Mar 13, 2009
- Runs on .NET 3.5 and with Visual Studio 2008 & Visual Studio 2008 SP1
- MVC Pattern architecture with Web Form Engine
- Html Helpers
- Ajax helpers
- Unit Testing
- Released on Mar 10, 2010
- Runs on .NET 3.5, 4.0 and with Visual Studio 2008 & 2010
- Strongly typed HTML helpers means lambda expression based Html Helpers
- Templated Helpers
- UI helpers with automatic scaffolding & customizable templates
- Support for DataAnnotations Attributes to apply model validation on both client and server sides
- Overriding the HTTP Method Verb including GET, PUT, POST, and DELETE
- Areas for partitioning a large applications into modules
- Asynchronous controllers
- Released on Jan 13, 2011
- Runs on .NET 4.0 and with Visual Studio 2010
- The Razor view engine
- Enhanced Data Annotations attributes for model validation on both client and server sides
- Remote Validation
- Compare Attribute
- Session less Controller
- Child Action Output Caching
- Dependency Resolver
- Entity Framework Code First support
- Partial-page output caching
- ViewBag dynamic property for passing data from controller to view
- Global Action Filters
- Use of NuGet to deliver software and manage dependencies throughout the platform
- Released on Aug 15, 2012
- Runs on .NET 4.0, 4.5 and with Visual Studio 2010SP1 & Visual Studio 2012
- NET WEB API
- Enhancements to default project templates
- Mobile project template using jQuery Mobile
- Display Modes
- Task support for Asynchronous Controllers
- Bundling and minification
- Support for the Windows Azure SDK
- Released on 17 October 2013
- Runs on .NET 4.5, 4.5.1 and with Visual Studio 2012 & Visual Studio 2013
- One ASP.NET
- NET Identity
- NET Scaffolding
- Authentication filters – run prior to authorization filters in the ASP.NET MVC pipeline
- Bootstrap in the MVC template
- NET WEB API2
Like dotnetkey.com on Facebook to get yourself updated towards latest tutorial on .Net.