开发者

ASP.NET MVC or ASP.NET MVC2 RC2 -> RTM

I am designing an green field application, development will start on it tomorrow as all the User Stories, etc. have been finalized. I plan on using Windows Azure, with ASP.NET MVC, I noticed that MVC 2 RC2 is about to be released but there is a lot less literature o开发者_运维百科n MVC 2 compared to MVC 1. Are there substantial differences between the two versions? I am thinking it would be prudent for me to just start using MVC 2 now, rather than later...

What do you guys think?


Go with MVC2. Scheduled release time is likely to be next month considering it's in RC now. Despite one of the other posters saying there are minor changes, there are actually significant changes:

  • Strongly typed extension helpers
  • Strongly typed views
  • View model data annotation validation
  • Many performance improvements w/r to caching the "reflecting" parts of the code (expression trees can get expensive)

One of the best features provided you're developing for .NET 4 is the <%: syntax for automatic HTML encodes for strings in your views.

So instead of using:

<%= Html.Encode("<script>alert('you've been hacked');</script>") %>

You can do this:

<%: "<script>alert('you've been hacked');</script>" %>

Think of it like turning the equal sign sideways, like closing the gate.


If you are confident that your go-live date will be well past the planned release date for MVC2, then I'd go with MVC2.


The differences between MVC1 and MVC2 are fairly minor and include features like website Areas and Client-Side JQuery validation against your object model. I strongly suggest starting with MVC2, rather than trying to use its predecessor.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜