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


Run WebAssembly Components Inside Node.js With Jco
28/03/2024

Jco 1.0 has been just announced by the Bytecode Alliance.It's a native JavaScript WebAssembly toolchain and runtime that runs Wasm components inside Node.js. Why is that useful?



Insights From AI Index 2024 Report
17/04/2024

Published this week, the latest Stanford HAI AI Index report tracks worldwide trends in AI. A mix of its new research and findings from many other sources, it provides a wide ranging look at how  [ ... ]


More News

<ASIN:0735627142>

<ASIN:1934356530>

<ASIN:193518279X>

<ASIN:1430227125>

<ASIN:0470643188>

<ASIN:1430228865>

<ASIN:1430225297>

Last Updated ( Thursday, 29 July 2010 )