Introduction
The porpose of this article is to discuss about the ASP.NET MVC, Features and the key benifits of ASP.NET MVC
Getting Started
ASP.NET MVC is web based design pattern which consists separation of concerns in the form of Model, View and Controller. We will discuss about Model, View and Controller later in this article.
ASP.NET MVC is introduced by Microsoft in December 2007 with MVC CTP(Beta) version, but it gets familar in 2003 with version MVC3. Later it's evaluated with multiple feature and now the current version is MVC6
ASP.NET MVC Patterns
As we disccued above ASP.NET MVC is divided into three broader sections, Model, View, and Controller. Below is how each one of them handles the task.- Model:- Model represents the real world object and provides data to the View. It refers to set of class, which descrives the data that application work with. For Example.
public class Student { public int ID{get; set;} public int Name{get; set;} public int Class{get; set;} public int Section{get; set;} }
- View:- View defines an applican's user interface,it is responsible for the look and feel. For example login page which contains TextBoxes etc. for taking user inputs like user name and password,button for submit the values. For Example
- Controller:- The Controller is responsible for taking the client's (End User) request and loading the appropriate Model and View in browser. It is set of classes that handles client request(End User), application flow, responds client request by communicates with model and renders the view based on the user inputs. For example
public class StudentController : Controller { public ActionResult Index() { //Logic to be execute return View(); } [HttpPost] public ActionResult Index(Student student) { //Logic to execute return View(); } }
Features of ASP.NET MVC
Many features are available with ASP.NET MVC, but here we have discussed three measure features.- Scaffolding:
Visual Studio's MVC Scaffolding uses templates to generate the routine code that is common to all ASP.Net MVC builds, such as data access and Web API. It allows the developer to concentrate on what is unique to the application.
- Routing
Routing is one of the most important feature in ASP.NET MVC,It helps to mapping incoming browser request to particular action of controller and Routing can be used to hide data which is not intended to be shown to the final user as well.
- Bundling and Minification
Bundling and minification are two techniques you can use in ASP.NET to improve page load performance for your web application. Bundling combines multiple files into a single file. Minification performs a variety of different code optimizations to scripts and CSS, which results in smaller payloads. Used together, bundling and minification improves load time performance by reducing the number of requests to the server and reducing the size of the requested assets (such as CSS and JavaScript files).
Benefits of ASP.NET MVC
- Separation of concerns:- Separation of concerns is achieved as we are moving the code-behind to a separate class file. By moving the binding code to a separate class file we can reuse the code to a great extent.
- Simplified testing and maintenance:- Each componet can be tested separately ensure that it is working properly according to requirement.
- Extensibility:- The ASP.NET MVC model consists of series of independent components, these componetns can be customized and replaced based on the requirements changes without interrupting the functionality of application.
Summary
In the above of this article we have discussed about ASP.NET MVC, their feature and benifits. Hope this article may helpful to you.
Thanks