Friday, July 31, 2009

ASP.NET MVC V2 Preview 1 Released

The Microsoft ASP.NET team just released the first public preview of ASP.NET MVC Version 2.  You can download it here

It includes support for:

  • Templated Helpers - allow you to automatically associate edit and display elements with data types. For example, a date picker UI element can be automatically rendered every time data of type System.DateTime is used. This is similar to Field Templates in ASP.NET Dynamic Data.
  • Areas - provide a means of dividing a large web application into multiple projects, each of which can be developed in relative isolation. This helps developers manage the complexity of building a large application by providing a way to group related controllers and views.
  • Support for Data Annotations - Data Annotations enable attaching validation logic in a central location via metadata attributes applied directly to a model class. First introduced in ASP.NET Dynamic Data, these attributes are now integrated into the default model binder and provide a metadata driven means to validating user input.

These are the big basics. However there are a number of other new teaser features in it. 

  • Default Parameter Values – Just what it says. The syntax is a little clunky but its a start in the write direction. In Visual Studio 2010 you’ll be able to do the same thing but with a less clunky syntax.
  • Binding Binary Data - ASP.NET MVC Preview 1 adds support for binding base64-encoded string values to properties of type byte[] and System.Data.Linq.Binary.  There are now two overloaded versions of Html.Hidden() that can take these data-types.  These can be useful for scenarios where you want to enable concurrency control within your application and want to roundtrip timestamp values of database rows within your forms. 

You can read more at Scott Gu’s post and Phil Haack’s MVC2 post