The ASP.NET team shipped ASP.NET MVC 2 Release Candidate 2 for VS 2008/.NET 3.5, and it’s the sequel to the RC version made available in December. It features bug fixes, performance optimizations, and API and behavior additions/changes. Below are a few of the changes between the RC1 and RC2 release (read the release notes for even more details):
- The new ASP.NET MVC 2 validation feature now performs model-validation instead of input-validation (this means that when you use model binding all model properties are validated instead of just validations on changed values of a model). This behavior change was based on extensive feedback from the community.
- The new strongly-typed HTML input helpers now support lambda expressions which reference array or collection indexes. This means you can now write code like Html.EditorFor(m=>m.Orders[i]) and have it correctly output an HTML input element whose “name” attribute contains the index (e.g. Orders for the first element), and whose “value” contains the appropriate value.
- The new templated Html.EditorFor() and Html.DisplayFor() helper methods now auto-scaffold simple properties (and do not render complex sub-properties by default). This makes it easier to generate automatic scaffolded forms. I’ll be covering this support in a future blog post.
- The “id” attribute of client-script validation message elements is now cleaner. With RC1 they had a form0_ prefix. Now the id value is simply the input form element name postfixed with a validationMessage string (e.g. unitPrice_validationMessage).
- The Html.ValidationSummary() helper method now takes an optional boolean parameter which enables you to control whether only model-level validation messages are rendered by it, or whether property level validation messages are rendered as well. This provides you with more UI customization options for how validation messages are displayed within your UI.
- The AccountController class created with the default ASP.NET MVC Web Application project template is cleaner.
- Visual Studio now includes scaffolding support for Delete action methods within Controllers, as well as Delete views (I always found it odd that the default T4 templates didn’t support this before).
- jQuery 1.4.1 is now included by default with new ASP.NET MVC 2 projects, along with a –vsdoc file that provides Visual Studio documentation intellisense for it.
- The RC2 release has some significant performance tuning improvements (for example: the lambda based strongly-typed HTML helpers are now much faster).
Today’s RC2 release only work with VS 2008 and .NET 3.5. We’ll shortly be releasing the VS 2010 RC (which will be available for everyone to download). It will include ASP. NET MVC 2 support built-in (no separate download required).
You can download it here.