It's been roughly five months since ASP.NET MVC 1.0 became available and developers flocked to download it. Now, after a brief break helping out with ASP.NET 4, Phil Haack and his team have gotten back in the saddle and started working on ASP.NET MVC 2.0.
Preview 1 of ASP.NET MVC 2.0 is now available for download and the team is looking for feedback. Here's a quick look at what's new and what's still coming.
One good thing to note about MVC 2.0 Preview 1 is that when you install it, it sits nicely alongside MVC 1.0. So you can have both running and not worry about conflicts. If you want to though, you can upgrade your MVC 1.0 project to MVC 2.0. It's a manual process outlined in the release notes, but it's not complicated.
New Features in Preview 1
Here's a quick look at some of these new features:
- Template Helpers: Template Helpers enable you to automatically associate elements to certain data types to control how the content is input and output. You do this by adding EditorTemplates and/or DisplayTemplates folder under the directory for either a specific controller or the Shared directory for all controllers. Within the folders, you add partial templates that dictate how the controller should be displayed. Here's a walkthrough on how to create Template Helpers.
- Areas: This new feature provides the ability to group controllers and other functionality across your MVC application. Each group can be its own MVC project that can then be referenced within the main MVC application. Areas are useful when you are building large applications.
- Built-In Support for DataAnnotations: DataAnnotations validation first shipped with .NET 3.5 SP1 and is now supported within MVC 2. It provides the ability to directly apply validation rules such as Required, StringLength and Range to the Model and ViewModel classes.
ASP.NET MVC 2.0 Preview 1 - Areas
There are a number of other new features including:
- New HttpPostAttribute Action Filter
- Support for DefaultValueAttribute in Action-Method Parameters
- Support for Binding Binary Data with Model Binders
In addition, there are some API improvements and a few bug fixes. And of course as this is a preview release there are a few known issues, some that could break your MVC 1.0 application. Be sure to review the release notes carefully.
Scott Gu, as always, provides a detailed look at what's new in ASP.NET MVC 2.0 Preview 1.
Still to Come for ASP.NET MVC 2.0
There is still work to be done on MVC 2.0 and beyond. According to the Roadmap, some additional features soon to come include:
- Client Validation: Providing client side validation based on the model's validation attributes
- Areas: Providing the ability to create areas without having to create separate projects for each area
- Strongly-typed link helpers: Discover controllers and helpers available for linking with the use of Intellisense.
The team does want your feedback, so be sure to head over to the ASP.NET MVC Forum and have your say.