CH01 ASP. NET MVC 4 Overview (4 UI)

Source: Internet
Author: User

MVC is a design pattern of an ASP. NET application system, which is now widely used in the development of enterprise-level Web applications. The MVC design pattern breaks down Web applications into three parts: models (Models), views, and Controllers (Controllers), each of which accomplishes different functions to implement Web applications. In order to facilitate the construction of MVC design model, Microsoft has launched a based on. NET Framework, an MVC framework integrated with ASP. This framework provides a template that integrates with Visual Studio and makes it easy to build an MVC Web application.

1.1 problems with traditional ASP. NET Web Form ScenariosBefore the introduction of MVC Design to ASP. NET Web application development, programmers are using Web forms to develop applications. The idea of a Web form is to introduce a form model from a Windows desktop application into the development of a Web application. This model quickly attracted a large number of traditional Windows desktop application development programmers, especially the former VB6.0 programmers. Today, many VB6.0 developers have moved to ASP. NET Web development, but they don't have basic HTTP and Web basics. To emulate the form development experience in traditional Windows desktop applications, Web Forms introduce an event-driven approach and introduce concepts such as ViewState and postback. In the end, Web Form technology completely overcomes the difficulty of stateless features in the web. Based on this guiding ideology, Web Forms technology has the following disadvantages: Web Form technology has the following disadvantages.
    • ViewState and postback improve the complexity of web application development. For example, even some very simple web pages may produce viewstate larger than 100KB, which can, of course, severely affect the performance of the system in some cases.
    • Developers have no control over the HTML generated by the Web form.
    • Asp. NET server control generates HTML that is both promiscuous and inline, and contains non-compliant, obsolete labels.
    • Integration with the JavaScript framework is difficult, mainly due to the naming conventions of the generated HTML.
    • The corresponding page declaration period for a Web form is too complex, and all content in the entire ASP. NET Framework is tightly coupled, and only one class is responsible for displaying output and handling user input. Therefore, unit testing is an almost impossible task.
1.2 MVCMVC English is Model-view-controller, that is, a Web application input, processing, output process according to model, View, Controller to separate the way, such an application is divided into three layers-model layer, view layer, control layer. The view represents the user interface, which can be generalized as an HTML interface for Web applications, but it can be XHTML, XML, and applets. With the complexity and scale of the application, the processing of the interface becomes challenging. An application may have many different views, the MVC design pattern is limited to the processing of the view's data collection and processing, and the user's request, not including the business process on the view. The processing of business processes is delivered to the model.    For example, an order view only accepts data from the model and is displayed to the user, as well as passing input data and requests from the user interface to the control and model. Model is the processing of business process state and the development of business rules. The process of processing a business process is a black box for other tiers, the model accepts the data requested by the view, and returns the final processing result. The design of the business model can be said to be the main core of MVC. The current popular EJB model is a typical application example, it makes a further division of the model from the angle of application technology implementation, in order to make full use of the existing components, but it cannot be used as the framework of application design model. The design of this model allows the use of dictation technology components to reduce technical difficulties. This allows developers to focus on the design of the business model. The MVC design pattern shows that the application model is extracted according to certain rules, and the level of abstraction is very important, which is also the design basis to judge whether the developer is excellent. Abstract and concrete cannot be too far apart, nor too close. MVC does not provide a design approach to the model, only that it should be organized to manage these models in order to reconstruct the model and improve reusability. You can use object programming to make metaphors, MVC defines a top-level class, and stipulates that its subclasses can only do this, but there is no limit to what can be done.              This is very important for developers. The design pattern has the following advantages: 1.3 asp . NET MVCThe ASP. NET MVC framework has the following features: installation of the 1.4 ASP. NET MVC 4 FrameworkASP. NET MVC 4 is built into Visual Studio 2012, and after you install Visual Studio2012, ASP. NET MVC4 is automatically configured on the developer's machine. 1.5 ASP. NET MVC application1.5.1 MVC Application Architecture 1.5.2 MVC Application Execution Experiment 1 creating the first application

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.