Analysis of ASP. net mvc 1.0

Source: Internet
Author: User

Why ASP. net mvc 1.0? I often ask this question when I first know that 1.0 is released.

Recently, we are considering whether to use ASP in our enterprise-level applications. net mvc 1.0 framework, so we will always look for reasons to use it. I hope you will share your thoughts with enterprise applications while paying attention to the technology.

1. Composition of MVC
Models
: Access the database, load data, and process business logic. The data entity class and business proxy class are embodied in the project.
Views: Displays data on the user interface. The project is embodied in the aspx page, and code-behind can be occasionally added.
Controller: Transmits the requested data to the specified page according to the routing rules for display. You can also pass the data entered by the user to the logic processing class. It can contain simple verification logic. Data access logic should not be included.
2. Why MVC?
The purpose of MVC is to improve development efficiency and testability.
According to the official ASP. net mvc 1.0 Guide (hereinafter referred to as the Guide), MVC-based Web applications have the following advantages:
[1] more convenient management of complex programs
It makes it easier to manage complexity by dividing an application into the model, the view, and the ontroller.

[2] higher controllability in development
It does 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.
[3] Routing gives more flexibility in Software Design
It uses a Front Controller pattern that processes Web application requests through a single controller. This enables you to design an application that supports a rich routing infrastructure.
[4] more suitable for test-driven development
It provides better support for test-driven development (TDD ).
[5] higher controllability in team development projects
It works well for Web applications that are supported by large teams of developers and Web designers who need a high degree of control over the application behavior.
The MVC framework also has the following features:
[1] dividing an application into components is more conducive to testing. The MVC Framework is based on interfaces, so that you can use the MOCK method to replace your actual classes. You can also choose not to run Contrllers during unit tests, so that testing is faster and more flexible.
[2] The MVC framework is scalable. You can design and replace the view engine, URL-oriented rules, and the parameter sequence of actions. At the same time, the MVC framework also supports dependency injection and control inversion. You can inject instances from the outside without requiring the class to create its own instances. You can also create instances through configuration files, this makes testing easier.
[3] Powerful URL ing components make the URL of your application easier to understand and search. Your URL does not need to include file paths. Such a design is suitable for custom query engines and REST architectures.
[4] The MVC framework still supports ASP.. NET pages, user controls, and master pages are used as view templates. You can also use nested master pages and in-line expressions (in-line expressions <% = %>), server-side controls, templates, data binding, localization, etc. are ASP. NET.
[5] simultaneously ASP. NET, such as FORM verification, Windows authentication, URL Authorization, Membership, role, output, data cache, Session, Profile status management, configuration, Provider framework, and other features are still available in the MVC framework..

Summary: The ASP. net mvc 1.0 framework is based on ASP. NET, so it includes almost all the features in ASP. NET. At the same time, he provided a set of testing solutions for the designers (of course, this is the common pattern of MVC for all language platforms ). In VS2008, the framework has been installed with a number of features that can be easily added to Views, Models, and Controllers.
3. Comparison with three-tier ASP. NET Applications
And common ASP. NET, the biggest difference lies in front-end development. There is no significant difference between the database access and logic processing in the background and the previous methods. In the MVC framework, these are collectively referred to as Model. In the layer-3 structure, these can be called the data access layer and the logic processing layer.
[1] Page Development
For websites developed in this mode, the code for viewing pages is indeed less than before, but it uses more page scripts (<%... %>) for displaying data. The Guide does not mention that server-side controls are not recommended, but it provides a large number of html helper and allows you to add Helper yourself, such as DataGridHelper, therefore, using these Helper in the MVC framework is more convenient, but this should not affect the skilled workers, because in actual development, we use Ctrl + C/Ctrl + V, copying several labels is similar to copying several Helper methods. For new users, if they are not familiar with tags, the speed of using these Helper will be faster, but this will affect their understanding of tags, which is really a conflict.
[2] data submission
Common ASP.. Net development, you may need to set data binding when submitting data, or write encapsulation code in code-behind. In MVC, the framework automatically encapsulates the data entered on the page to a specified Model. Data submission is convenient in the MVC framework. In addition, on common ASP. NET pages, attributes cannot be bound back, which can be solved in MVC. As mentioned in the Guide, the use of Routing makes it easier for applications in the MVC Framework to operate custom queries. In fact, the query method is no different from the normal one, all parsing encapsulated classes. As for "URL is easier to understand", applications are now performing operations by clicking on the interface. Few people will pay attention to the URL itself, so this advantage is not an advantage.
[3] unit test
From the test point of view, the MVC framework is indeed doing well. It is more convenient to use MOCK for testing. A good WEB application design should separate page presentation from logic, which is common ASP. NET Applications can also be achieved, the key lies in the design.
[4] others
The MVC framework has several new features in verification and master pages, but it is similar to the common ASP. NET method.

Correct the analysis in this article.

From: http://www.cnblogs.com/andy1027/archive/2009/04/01/1427369.html

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.