Razor…

Unless you’ve been living under a rock lately, you’ll at least have heard of MVC and Razor even if you don’t really know what they are…

ASP.NET MVC 3 is the next major release of ASP.NET MVC. ASP.NET MVC is a part of the ASP.NET Web application framework. It is one of the two different programming models you can use to create ASP.NET Web applications,the other being ASP.NET Web Forms.

  • Complete control over your HTML Markup
  • Enables rich AJAX and jQuery integration
  • Allows you to create SEO-friendly URLs for your site
  • Makes Test Driven Development (TDD) easy

I personally like working with MVC, can’t exactly put my finger on why, but most of my web-based projects these days are MVC2/3.

Now: Microsoft have really been pushing out new technologies over the last number of years and a few month back I found myself saying that I would try not to dip my fingers in all the new pies as I’ve been doing over the last number of years. One of these so called pies was the Razor view engine.

However I happened to have a play around with a few Webmatrix projects and was exposed to Razor unintentionally……

All I can say is i’m very impressed and hence forth all my new MVC3 projects will be Razor based.

The best thing is that there is no learning curve (nearly), bacially just put a “@” character before any code and a way you go! Yes it’s really that simple.

e.g.

 

image

Shows the controller setting a value on the ViewBag (a dynamic property .net 4)

 

image

Shows the client page rendering the text, also shows the new Layout mechanism for Razor.

 

image

Important part is the @RenderBody()  ; note the DOCTYPE too HTML5…Secret telling smile
Comments are closed