Introduction to ASP.NET MVC

Category > ADO.NET || Published on : Sunday, July 6, 2014 || Views: 7853 || mvc need of mvc mvc pattern mvc 3 mvc 4 mvc version mvc introduction pdf


ASP.NET MVC is a new web application framework from Microsoft. ASP.NET MVC stands for "Model-View-Controller", a pattern that’s becoming increasingly popular with web development frameworks.

ASP.NET MVC is an alternative and a complement to Web Forms, which means you won’t be handling with pages and controls, postbacks or view state, or complicated asp.net event life cycles.

 

The Model-View-Controller (MVC) architectural pattern separates an application into three main components: the model, the view, and the controller. The ASP.NET MVC framework provides an alternative to the ASP.NET Web Forms pattern for creating MVC-based Web applications. The ASP.NET MVC framework is a lightweight, highly testable presentation framework that (as with Web Forms-based applications) is integrated with existing ASP.NET features, such as master pages and membership-based authentication.

The MVC framework is defined in the “System.Web.Mvc “ namespace and is a fundamental, supported part of the “System.Web” namespace.

 

Basically, Asp.NET MVC is a framework methodology that divides an application's implementation into three component roles: “Models”, ”Views” , and “Controllers”.

Hence in Asp.net MVC you need to deal with controllers, actions, and views.

MVC Pattern History

The Model-View-Controller (MVC) pattern is an adaptation of a pattern generated from the Smalltalk community in the 1970s by “Trygve Reenskaug”. It was popularized for use on the web with the advent of Ruby on Rails in 2003.

    1. Model

 Model objects are the parts of the application that implement the logic for the application s data domain. Often, model objects retrieve and store model state in a database. For example, a Product object might retrieve information from a database, operate on it, and then write updated

    2. View

Views are the components that display the application s user interface (UI). Typically, this UI is created from the model data. An example would be an edit view of a Products table that displays text boxes, drop-down lists, and check boxes based on the current state of a Products object.

    3. Controller

Controllers are the components that handle user interaction, work with the model, and ultimately select a view to render that displays UI. In an MVC application, the view only displays information; the controller handles and responds to user input and interaction. For example, the controller handles query-string values, and passes these values to the model, which in turn queries the database by using the values.

 

ASP.NET:- MVC Web Application Advantages

  1.     MVC Framework is built upon a proven MVC design-pattern. Hence, this is not a new technology.
  2.     One of the biggest problems in ASP.NET is HTML size of controls and view state. View state stores all the data rendered and final HTML gets too large. If you are on a slow internet connection, you will notice load time delays. This has been taken care in MVC framework. There is no view state concept in MVC framework.
  3.     Client caching is available now with the help of Silver light. By integrating Silver light, we can take advantage of it. That makes applications load faster and some of the processing can be done in web browsers. Not only the client site but the server side execution is faster too. JQuery integration with MVC makes it even better and now we can write our code that runs in the browser and takes away load from the server.
  4.     Support multiple views
  5.     Support unit testing as a part of Visual Studio 2008 and 2010

 

 

The ASP.NET MVC simplifies the complex parts of ASP.net Web Forms without any compromise of the power and flexibility of ASP.NET platform.

ASP.net MVC implements Model-View-Controller UI pattern for web application development that lets you allows to develop applications in a loosely couples manner. MVC pattern is separating the application in three parts- Model, View and Controller.