ASP .NET MVC 3 Preview
Wednesday, 28 July 2010

A preview of version 3 of the ASP .NET MVC framework is available before programmers have had time to settle in with version 2. Microsoft seems to be serious about making MVC the way to do ASP.

Banner

 

Microsoft's MVC framework is currently one of its fastest pieces of development. Hot on the heels of version 2.0 (issued in March) we now have a preview of version 3.0 - download from: Microsoft Downloads.

 

ASP

The update claims to be compatible with version 2.0 so you can install the new framework and carry on working. It can be installed along side the earlier versions adding a new set of project templates to Visual Studio. It also works with Web Developer 2010 Express.

The biggest change is the inclusion of the Razor view engine. You can now select between a standard ASPX or a Razor based MVC 3 project:

MVC3

Whether you think that Razor is a good idea or not is another matter. It produces denser code and mixes HTML and procedural code in a way that could easily become uncontrolled. On the other hand it is undeniably simpler and more direct.  At the moment the Razor syntax is not fully supported by IntelliSense but it will be in the next release, along with unit testing and a default page layout.

The other big new feature is the  Add View dialog box now allows you to select which template engine to use. A drop down list lets you pick from any that you have installed. This makes it easier to use and develop third-party template engines. 

If you are keen on using Ajax the new JSON binding support will also be welcome. You can build a JSON request in the usual way, using jQuery makes it easy, and then write an action method to handle the request that accepts a parameter with properties that correspond to the JSON fields posted. That is the Javascript object that the JSON would generate is automatically available as a .NET object. Support for the jQuery validation library and better support for "unobtrusive" Javascript - even though this is a vague concept.  

Support for the Dependency Injection (DI)way of doing things has also been augmented. You can now use DI in controllers, views and action filters. Future previews will support DI in model binders, value providers and model metadata providers. MVC 3 supports the Common Service Locator library. DI is not a pattern much used in web application development but it is a natural match for the MVC approach.

There are a host of other minor improvements: Controller global filters, new ActionResult types, new model validation attributes and permanent redirects.

Although you can still use the ViewData property to pass data to the view you can now also use the dynamic ViewModel and access data via properties rather than dictionary keys. This seems like a good use of the new dynamic language facilities.

For more information see: http://www.asp.net/mvc

 

ASP

Further reading

Microsoft WebMatrix and Razor

MVC - it's the routing stupid!

ASP.Net MVC in Action

The Joomla MVC classes

Dependency Injection

Banner


Microsoft Introduces .NET Smart Components
01/04/2024

Microsoft has provided a set of .NET Smart Components, described as a set of genuinely useful AI-powered UI components that you can quickly and easily add to .NET apps. The components are prebuilt end [ ... ]



Explore SyncFusion's Blazor Playground
16/04/2024

Syncfusion has provided an in-browser environment where you can write, compile and run code that uses Blazor components and get it previewed live.


More News

<ASIN:0735627142>

<ASIN:1934356530>

<ASIN:193518279X>

<ASIN:1430227125>

<ASIN:0470643188>

<ASIN:1430228865>

<ASIN:1430225297>

Last Updated ( Thursday, 29 July 2010 )