Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the new features of ASP.NET MVC2 RC2

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "what are the new functions of ASP.NET MVC2 RC2". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what are the new features of ASP.NET MVC2 RC2"?

The main changes from ASP.NET MVC 2 RC 1 to ASP.NET MVC 2 RC 2 are as follows:

1. The function of ASP.NET MVC 2 validation (validating Model data in ViewData) added in RC1 has been replaced by input-validation by model-validation. That is, if you use model binding (automatically binds the Model property to the View and automatically binds the value of Post back to the Controller from the View), then all properties will be validated, not just the changed data.

(note: personally, this may cause inconvenience in some cases, such as when you want to bind only some of the properties in a model as a temporary "container", it may turn ModelState.IsValid into false. I wonder if the new features can be used selectively)

2. The new "strongly typed HTML helper method" now supports Lambda expressions, which allows you to use arrays (array) or set indexes (collection indexes). For example, you can now do this: Html.EditorFor (m = > m.Orders [I]), this code will generate a tag with sequence I as name and the value in the specific array as value.

(note: this will be extremely useful in DropDownList. )

3. The readjusted Html.EditorFor () and Html.DisplayFor () extension methods automatically correspond to simple properties by default. This makes it easier to construct Form forms automatically.

(note: finally, it is a bit like the Form of some "predecessors" MVC. I hope this improvement can come more violently.)

4. The id in the client script used for model authentication is now clearer. In RC1, the id would look like this: form0_ prefix, and now id is prefixed with the attribute name, such as: unitPrice_validationMessage.

(note: this change can make the foreground developer have more complete control over the page.)

5. The Html.ValidationSummary () method adds a parameter that controls the level at which the summary information is displayed, the entire Model level or the individual attribute level.

(note: it has become more user-friendly. For some pages, we only need to have it display a tip. There is no need to repeat all of them.)

6. Using the default ASP.NET MVC Web Application template in AccountController is cleaner.

7. The scaffolding (scaffolding) function now provides Delete methods in Controller, as well as View pages (templates).

8. JQuery 1.4.1 is included in the project, replacing the previous version 1.3.2. Also updated synchronously is the vsdoc file for intelligent prompts.

9. Other meaningful improvements, such as the "strongly typed HTML (tag) helper method" in point 2, are now faster.

The source code of the minor version can be downloaded here: http://aspnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=39978

ASP.NET MVC extended reading

ASP.NET MVC is a framework for writing ASP.NET Web applications in MVC mode provided by Microsoft officially.

It comes from the MonoRail of Castle. So far, it has gone through several versions. The MVC in ASP.NET MVC originally exists in the Desktop program, M refers to the data model, V refers to the user interface, and C is the controller. The purpose of using MVC is to separate the implementation code of M and V so that the same program can use different representations. For example, a batch of statistics can be represented by bar charts and pie charts respectively. The purpose of C is to ensure the synchronization of M and V. once M changes, V should be updated synchronously.

MVC pattern diagram

ASP.NET MVC framework is another way of development after ASP.NET WebForms. It provides a range of excellent features that give ASP.NET developers another option. The ASP.NET MVC framework option is very clean and easy to use. It will allow you to easily maintain separation of concerns in your application and facilitate clean testing and TDD.

At this point, I believe you have a deeper understanding of "what are the new features of ASP.NET MVC2 RC2?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report