ASP. net mvc is relative to the traditional Form of ASP. NET Web Form. The MVC framework has a strong advantage, and WebForm is not useless. It is easier to develop in simple applications. The following briefly introduces ASP. net mvc.
What is ASP. net mvc?
Before learning about ASP. net mvc, you should first understand what MVC is. MVC is the abbreviation of Model-View-Controller, that is, Model-View-Controller. MVC is used to represent a software architecture Model. It divides the software system into three basic parts: Model), View) and Controller ). Model) generally refers to the "data Model", which is used to encapsulate data related to the application's business logic and to process the data. "Model" has the right to access data directly, such as accessing a database. "Model" does not depend on "View" and "controller", that is, the model does not care about how it is displayed or operated. View) is the UI Layer to display data. Controller) acts as an organizational unit between different layers and is used to control the process of an application. It processes events and responds.
ASP. net mvc provides a new Model-View-Controller MVC, Model-View-Controller) framework at the top layer of the existing ASP. NET 3.5 runtime. This allows developers to use the advantages of the MVC design pattern to create their own ASP.. NET Web application, which clearly separates the content display UI or View, business logic, and background data.. NET.
What is ASP. net mvc? What is the relationship between ASP. net mvc and ASP. NET Web Form?
ASP. net mvc is just another design pattern used to Develop ASP. NET applications. It does not replace ASP. NET Web Form pattern, but does not conflict with each other.
What are the advantages of ASP. net mvcasp. net mvc:
ViewState is no longer available: traditional ASP. NET WebForm mode uses ViewState to save the state information of the form. Due to the limitations of the B/S program, ViewState must store a large string in the hidden form field, this will greatly increase the number of page bytes, resulting in slow webpage loading;
Brief HTML: The final HTML code is completely controlled by the user, and no "junk code" is generated ";
Faster server-side processing and client rendering: MVC simply processes "templates" without building a complex control tree, and client rendering speed will be improved;
Only one model is required for multiple views: Sometimes the data to be displayed on a page is the same, but there are slight differences in the form. In this case, you only need to modify the view section, the existing controller behavior can be used;
Unit test: it is very difficult to test Webform. using MVC, you can split the business logic from the page and execute controllers in ASP. NET processes to facilitate testing.
- Differences between ASP. net mvc and WebForm
- ASP. net mvc unit test: confusing the Path attribute of the HttpContext class
- Custom ControllerFactory: interface implementation, supporting Area
- ASP. NET Routing
- Add custom routes for ASP. net mvc applications