New Features in ASP.NET MVC 3/4

MVC 3 and 4 come with many improvements and several new features in addition to
the new dependency on .NET 4.

These new features include:

 

■ The Razor view engine
■ Package management with NuGet
■ Improved extensibility
■ Global action filters
■ Dynamic language features

■ Partial page output caching
■ Ajax improvements
■ Enhancements to the validation infrastructure
■ Mobile templates
■ Web API

 

1. The Razor view engine

  This engine provides a concise way to mix code and markup within the same file.

classic code:

<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<Product[]>" %>
<ul>
<% foreach(var product in Model) { %>
<li><%: product.Name %></li>
<% } %>
</ul>

 

razor code:

@model Product[]
<ul>
@foreach(var product in Model) {
<li>@product.Name</li>
}
</ul>

 

 

 

posted @ 2012-07-05 15:00  Master HaKu  阅读(142)  评论(0编辑  收藏  举报