ASP.NET MVC 3 automatically installs and enables NuGet as part of its setup. NuGet is a free open-source package manager that makes it easy to find, install, and use .NET libraries and tools in your projects. It works with all Visual Studio project types (including ASP.NET Web Forms and ASP.NET MVC).
NuGet enables developers who maintain open source projects (for example, projects like Moq, NHibernate, Ninject, StructureMap, NUnit, Windsor, RhinoMocks, and Elmah) to package their libraries and register them in an online gallery. It is then easy for .NET developers who want to use one of these libraries to find the package and install it in projects they are working on.
With the ASP.NET 3 Tools Update, project templates include JavaScript libraries pre-installed NuGet packages, so they are updatable via NuGet. Entity Framework Code First is also pre-installed as a NuGet package.
For more information about NuGet, see the NuGet documentation on the CodePlex site.
Partial-Page Output CachingASP.NET MVC has supported output caching of full page responses since version 1. MVC 3 also supports partial-page output caching, which allows you to easily cache regions or fragments of a response. For more information about caching, see the Partial Page Output Caching section of Scott Guthrie's blog post on the MVC 3 release candidate and the Child Action Output Caching section of the .
Granular Control over Request ValidationASP.NET MVC has built-in request validation that automatically helps protect against XSS and HTML injection attacks. However, sometimes you want to explicitly disable request validation, such as if you want to let users post HTML content (for example, in blog entries or CMS content). You can now add an AllowHtml attribute to models or view models to disable request validation on a per-property basis during model binding. For more information about request validation, see the following resources:
In ASP.NET MVC 3 you can add project templates, view engines, and unit test project frameworks to the New Project dialog box.
Template Scaffolding ImprovementsASP.NET MVC 3 scaffolding templates do a better job of identifying primary-key properties on models and handling them appropriately than in earlier versions of MVC. (For example, the scaffolding templates now make sure that the primary key is not scaffolded as an editable form field.)
By default, the Create and Edit scaffolds now use the Html.EditorFor helper instead of the Html.TextBoxFor helper. This improves support for metadata on the model in the form of data annotation attributes when the Add View dialog box generates a view.
New Overloads for "Html.LabelFor" and "Html.LabelForModel"New method overloads have been added for the LabelFor and LabelForModel helper methods. The new overloads enable you to specify or override the label text.
Sessionless Controller SupportIn ASP.NET MVC 3 you can indicate whether you want a controller class to use session state, and if so, whether session state should be read/write or read-only. For more information about sessionless controller support, see .
New "AdditionalMetadataAttribute" ClassYou can use the AdditionalMetadata attribute to populate the ModelMetadata.AdditionalValues dictionary for a model property. For example, if a view model has a property that should be displayed only to an administrator, you can annotate that property as shown in the following example:
public class ProductViewModel { [AdditionalMetadata("AdminOnly", true)] public string RefundCode {get; set;} }This metadata is made available to any display or editor template when a product view model is rendered. It is up to you to interpret the metadata information.
AccountController improvementsThe AccountController in the Internet project template has been greatly improved.
New Intranet Project TemplateA new Intranet Project Template is included which enables Windows Authentication and removes the AccountController.
热门源码