
Phil Hack (Phil Haack) in his blog
published the news about the release of
ASP.NET MVC 2 RC2 . The news is excellent, because although there are no special new features in this release, there are significant changes. Next, we consider a complete list of these changes.
Updated functionality
The most important thing in this version is the updated ASP.NET MVC validation system. More details about the innovation can
be found in this article , and here I will only give a small description. Previously, validation in ASP.NET MVC worked on a form, that is, only those fields that were transferred to the server were subject to server validation. This behavior was not transparent to developers, many believed that if they defined validation rules for the model fields, then the whole model will always be validated. However, this was not the case. Now, the validation mechanism is repelled from the model, so it does not matter what model data came from the form, when linking the data, validation will be applied to all elements of the model.
This innovation makes the server validation behavior more transparent to the developer, but does not completely solve all security issues. More on these security issues in
my article .
')
Other fixes
There are quite a few small changes in the new version of ASP.NET MVC 2 RC:
- projects have updated the MicrosoftAjax.js file, its version corresponds to the latest version of ASP.NET Ajax included in ASP.NET 4 , and ASP.NET 3.5 SP1 is also supported;
- improved performance in many places of the framework;
- TempDataDictionary now contains a Peek method that allows you to extract data without removing it from the collection;
- Now, by default, Html.EditorFor and Html.DisplayFor form markup only for simple data, for complex it is proposed to create your own templates;
- the Add View command in the context menu now allows you to create a view for deleting data; the existing List view now contains links to delete list items;
- helper validation methods no longer add the form0 prefix for the id attribute when rendering;
- helper methods that render input fields now generate correct values for the name attribute, in the case where the render element is a collection or array element;
- Added the UrlParameter type with the only Optional property that can be assigned to the route parameter so that the MVC ( MvcHandler ) routing mechanism can remove this parameter from the collection of the RouteData.Values parameters after routing, but before calling the controller method. This will avoid the conflict of the names of the parameters of the routes with the names of the model. This innovation is already used in the ASP.NET MVC 2 Web Application project;
- a small file with styles was added to an empty MVC project, for use by default in auxiliary validation methods;
- T4 templates can now specify an extension for generated files.
Corrected mistakes
This release fixes several bugs:
- SessionStateTemDataProvider no longer stores the TempData value in a session when there is no data in TempData ;
- the GetValue method of the FormCollection class can now accept empty strings in a parameter (I find it difficult to say right away when it is needed);
- now it is possible to programmatically disable client validation for the submit button; previously, it was required that the submit input element contain the name attribute;
- client validation, in case of failure, now prevents Ajax requests from the form.
Conclusion
As you can see, the list of fixes is big. Many fixes are minor or have little effect, but there are some that play an important role and it is highly desirable to know from the ASP.NET MVC developer. I hope this article will help you understand and get a basic idea of the new version of ASP.NET MVC 2.
Like several previous ASP.NET MVC 2 test releases, this release is not compatible with
Visual Studio 2010 (Beta 2 or lower). Installation on systems with VS2010 is not supported. It is expected that VS2010 RC, which should appear soon, will contain the final version of ASP.NET MVC 2. I suggest waiting for it, for those who use Visual Studio 2010 in their work.
Download ASP.NET MVC 2 RC2 from
this page , there are also release notes (.doc).
Download the source codes of this version of ASP.NET MVC 2
here , there are the source codes of MVC Futures.
