ASP. net mvc 3 is becoming increasingly popular

Source: Internet
Author: User

When ASP. NET 3 RC was released this month, I was still studying MVC application frameworks such as struts on the Java platform.ProgramFor developers, do not write large volumes of pagesCodeReally comfortable. If I hold her again and say something that may upset Java programmers: Since ASP. net, I feel very good, and she is still very young, this feature has been greatly improved, enough for me to engage in a period of time, his home things develop really fast, in a word, Asp. net MVC 3 is getting worse and worse.

Main Components of ASP. NET MVC

All concepts are centered on the following three main components:

· Model (represented by m): A model is a business object that represents the underlying database model and contains the data/Status of MVC applications.

· View (expressed in V): View refers to the application UI. in ASP. net mvc applications, a view is usually a. aspx and. ascx file.

· Controller (represented in C): the controller is ASP. net MVC Framework is the core of the application. It is responsible for presenting the appropriate view to the client, executing relevant behavior methods, obtaining data from the model, then filling in the view, or getting data from the view, then update the model.

Figure 1 shows the relationship between the three components in the MVC mode.

 

Figure 1 three components of the MVC Framework

Seven top-level functions of ASP. net mvc 3 framework

Visual Studio supports razor smart prompts

Visual Studio and free Visual Web Developer express provide support for razor-based view templates. When you edit a razor Based View template, smart prompts for HTML, C #, VB, JavaScript, and CSS are supported.

ASP. net mvc framework reduces the complexity of Concurrent Development

When you create ASP. net MVC application, you will find that in the Visual Studio ide solution, three folders, controller, view, and model, are automatically created, the Controller and view must be separated into different files.

 

URL routing, the Controller responds to the request

And General ASP.. NET applications are different, Asp.. Net MVC application requests are not files on the disk, such. the aspx file is generated directly by the controller. The following is an example of the request URL format:

HTTP: // Localhost: 34299 /< Controller >/< Actionmethodname >

 

Support Test-driven development

Because the MVC Architecture is loose, building unit test cases becomes simple. It makes test-driven development possible. For example, if you have a normal one. aspx. CS page, you want to create unit test cases for it, the complexity is very high, because:

· You must create an instance for your page code hiding class;

· The hidden code points to the ASP. NET control;

· It is difficult to create unit test cases for events (such as gridview_rowdatabound.

In MVC mode, there is no code behind the file or UI element reference, which makes the task very easy. All you need to do is to point to the actionmethod of the controller, right-click and choose create unit test ".

 

Availability of HTML auxiliary methods

ASP. net MVC view is driven by HTML, and you do not need to use any ASP. NET Server Control, Asp. net MVC provides a bunch of HTML auxiliary methods to simplify view development tasks. The best thing is that developers can get 100% smart prompts of these HTML auxiliary methods.

 

Template Function

The template function is ASP.. Net MVC 2.0 introduces new features. This feature allows you to create a shared local view, which can be directly used in other views. The HTML auxiliary methods used to edit the template function include: HTML. editorfor, HTML. editor and HTML. editorformodel.

 

Use the data annotation attribute for verification

The ASP. net mvc Framework provides some data annotation attributes for data verification. These attributes are used to describe the fields exposed by the model. Below are some of the attributes:

· Required

· Displayname

· Stringlength

· Scaffoldcolumn

· Range.

 

Implementation of ASP. net mvc crud: scaffold availability

In daily application development, developers spend the most time writing code, but most of the time they repeatedly create data items (c) and read data (R), update (U) and delete (d) operations, Asp. the net MVC Framework provides a scaffold for crud operations. When you create a controller, you can choose to allow the framework to help you create a behavior method for crud operations.

ASP. NET 3 RC (Release Candidate ). You can download it from here.

Related Article

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.