- The Model-View-Controller (MVC) architectural pattern separates an application into three main components: the model, the view, and the controller.
- The MVC framework is defined in the System.Web.Mvc assembly.
- Models. Implements the critical functionality of an application from business point of view.Often model objects retrieve and store model state in a database. Set of classes that describes the data we are working with as well as the business rules for how the data can be changed and manipulated
- Views. Defines how the application’s user interface (UI) will be displayed.This UI is created from the model data
- Controllers. This is a special class that manages the relationship between the View and Model. Handles and responds to user inputs/events, talks to the model, and decides which view to render
Benefits Compared to Web Forms
- The MVC pattern itself makes it easier to manage complexity by clearly separating the functionality of the application into three core parts, the model, the view, and the controller.
- ASP.NET MVC web applications do not use view state or server-based forms. This makes the MVC framework ideal for developers who want full control over the behavior of an application. View state can become very large, which is a problem for devices like smartphones running over slow.
- ASP.NET MVC provides better support for test-driven development (TDD)
- ASP.NET MVC works well for web applications that are supported by large teams of developers and for web designers who need a high degree of control over the HTML.