Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News ASP.NET Reaches a New Milestone: ASP.NET MVC 3 Preview 1

ASP.NET Reaches a New Milestone: ASP.NET MVC 3 Preview 1

This item in japanese

Although ASP.NET MVC 3 Preview 1 has not been announced yet, the framework can be downloaded from Microsoft downloads. The list of new features include: Dependency Injection, Razor View Engine, Dynamic View and ViewModel properties, and Global Filters.

ASP.NET MVC 3 Preview 1 comes with new features, the most important being:

  • Razor View Engine – this view engine has been covered by InfoQ in a previous post. ASP.NET MVC 3 currently supports only C# (.cshtml files), VB.NET support being planned to be added later.
  • Dynamic View and ViewModel Properties – Views have a new dynamic View property offering simple access to the ViewData object. An example would look like this:
public ActionResult Index() {

ViewData["Title"] = "The Title";

ViewData["Message"] = "Hello World!";




Also, the Controller class has a dynamic property ViewModel offering better access to the ViewData dictionary like in this example based on the previous one:

public ActionResult Index() {

ViewModel.Title = "The Title";

ViewModel.Message = "Hello World!";


  • “Add View”  Dialog Supports Multiple View Engines -  The Add View dialog in Visual Studio now support the option to select from multiple view engines.
  • Dependency Injection – ASP.NET MVC now supports IoC containers to discover the following services and dependencies: controller factories, dependencies on view pages for types derived from ViewPage, ViewUserControl, ViewMasterPage, WebViewPage, for both Web Form and Razor view engines, and dependencies on action filters.
  • Global Filters – ASP.NET MVC now supports adding filters to all action methods of a controller.
  • JsonValueProviderFactory Class – This class can be used to connect client templates to action methods that receive/send JSON data.
  • Support for .NET Framework 4 Metadata Attributes

ASP.NET MVC 3 runs side by side with ASP.NET MVC 2, allowing the developer to choose which one to use. It is also possible to upgrade older projects to make use of the new framework, but the upgrade is not fully automatic. The release notes suggest to:

… create a new ASP.NET MVC 3 project and copy all the views, controllers, code, and content files from the existing MVC 2 project to the new project and then to update the assembly references in the new project to match the old project. If you have made changes to the Web.config file in the MVC 2 project, you must also merge those changes with the Web.config file in the MVC 3 project.

ASP.NET MVC 3 needs .NET 4.0 and Visual Studio 2010 or Visual Web Developer Express 2010.

Rate this Article