Posts Tagged ‘MVC’

Razor View Engine For MVC2

Thursday, July 8th, 2010

Check out Scott Guthrie’s new blog post on  Razor the new view engine that will ship with MVC 2 shortly.

At first glance it looks really nice and simple to learn. Essentially rather than wrapping your code elements in your view with <% %> tags you can simply use an @ symbol. The view engine has syntactic awareness built into it so there is  no need to close off your tags. If you want to declare multiple lines of code you use the following you wrap your code in the following symbols @{  code goes here } This will go a long way to reduce the tag soup that you get in your views with the current out the box MVC view engine.

In Scott Gu’s blog he also states that it will be possible to fully Unit Test your views without the need of a web controller or web server. This sounds really interesting to me and I wonder how far Microsoft will take it as I would love to see this extend into being able to test your JQuery in your views as well, as these days I find this is where the majority of the logic sits. I know it is possible test JQuery with frameworks such as QUnit but I haven’t been altogether comfortable with the amount of duplicated HTML that you have create in order to write your tests…I digress maybe that’s a subject for another post.

Anyway I look forward to it’s release.