ASP.NET MVC 2 RC 2 is out

Release Candidate 2 of most awaited ASP.NET MVC 2 is out on 4th Feb 2010..

This release includes updates and bug fixes and new functionality additions..

Version: 2
Date Published: 2/4/2010
Language: English
Download Size: 107 KB – 2.6 MB*

Download ASP.NET MVC 2.0 Release Candidate 2

New Features in RC 2

Default validation system validates entire model

The default validation system in ASP.NET MVC 1.0 and in previews of ASP.NET MVC 2 prior to RC 2 validated only model properties that were posted to the server. In ASP.NET MVC 2, the new behavior is that all model properties are validated when the model is validated, regardless of whether a new value was posted. Applications that depend on the ASP.NET MVC 1.0 behavior may require changes.

For more information about this change, see the entry Input Validation vs. Model Validation in ASP.NET MVC on Brad Wilson’s blog.

Other Improvements

The following changes have been made to existing types and members for the ASP.NET MVC 2 RC 2 release.

  • The MicrosoftAjax.js script file in new projects has been updated to the version of ASP.NET Ajax that is included in ASP.NET 4. The new script file is compatible with both ASP.NET 3.5 SP1 and ASP.NET 4.
  • Many areas of the framework have had performance improvements.
  • The TempDataDictionary type has a new Peek method that reads values from TempData without removing the values from the dictionary.
  • Templated helpers such as Html.EditorFor and Html.DisplayFor show only simple properties by default. If you need to show complex properties, you can create a custom template to show any set of properties.
  • The Add View context menu in Visual Studio lets you create a view to delete items. The existing List template has a new Delete link for each item in the list.
  • The validation helpers no longer render a default “form0” prefix for the id attribute.
  • Expression-based helpers that render input elements generate correct name attributes when the expression contains an array or collection index. For example, the value of the name attribute rendered by Html.EditorFor(m => m.Orders[i]) for the first order in a list would be Orders[0].
  • The new UrlParameter type allows default values in routes to be removed after URL routing runs. If an incoming route parameter has a value of UrlParameter.Optional, the MvcHandler instance will remove it from RouteData.Values collection before the controller action is executed. The Global.asax file in new projects uses UrlParameter.Optional in the default route definition. This makes it easier to bind to models that have a property named ID, because the default ID route parameter will not conflict with the binding operation.
  • The empty project template includes a small Site.css file that contains styles that are used by validation helpers such as Html.ValidationSummary and Html.ValidationMessage.
  • T4 template files can use the <#@ output extension=”.ext” #> directive to specify the file extension for the generated file.

Bug Fixes

The following bugs have been fixed in the ASP.NET MVC 2 RC 2 release.

  • SessionStateTempDataProvider no longer saves TempData values in session state when there is no temporary data to store.
  • The GetValue method of the FormCollection class now allows empty string values.
  • You can now programmatically disable client validation for a submit button (an input elements whose type attribute is set to “submit”) even if the button does not have its name attribute set, whereas before it required the name attribute.
  • A client validation failure will now prevent an Ajax form from being submitted to the server.

Breaking Changes

The following changes might cause errors in existing ASP.NET MVC 1.0 applications.

Changes in ASP.NET MVC 2 Release Candidate 2

Every property for model objects that use IDataErrorInfo to perform validation is validated, regardless of whether a new value was set. (See Default validation system validates entire model earlier in this document.) In ASP.NET MVC 1.0, only properties that had new values set would be validated. In ASP.NET MVC 2, the Error property of IDataErrorInfo is called only if all the property validators were successful.

 Courtesy of this content is from MVC 2.0 RC2 – Release Notes