Quantcast
Channel: ASP.NET Blog
Viewing all articles
Browse latest Browse all 7144

Release Candidates for ASP.NET MVC 5.1, Web API 2.1 and Web Page 3.1.

$
0
0

Today we shipped release candidates for ASP.NET MVC 5.1, ASP.NET Web Pages 3.1 and Web API 2.1 to the NuGet gallery. In this release we are previewing some of the runtime features in ASP.NET and Web Tools 2013.2, which will include a broader set of updates to ASP.NET SignalR, ASP.NET Identity, Entity Framework, and the Microsoft OWIN Components as well as tooling updates to the Web Editors, Browser Link, Scaffolding, NuGet and Windows Azure WebSite publishing. We will be previewing all of these features along the way before all of the features are released.

Download this release

You can download the release candidates for ASP.NET MVC 5.1, Web API 2.1, Web Pages 3.1 as preview NuGet packages from the NuGet gallery. You can install or update to these pre-release packages through NuGet using the NuGet Package Manager Console, like this:

  • Install-Package Microsoft.AspNet.Mvc -Version 5.1.0-rc1 –Pre
  • Install-Package Microsoft.AspNet.WebApi -Version 5.1.0-rc1 –Pre
  • Install-Package Microsoft.AspNet.WebPages -Version 5.1.0-rc1 –Pre

Please remember to select the “Include Prerelease” option when searching for packages using the NuGet Package Manager or the Package Manager Console. For more information on how to install pre-release packages please read http://docs.nuget.org/docs/Reference/Versioning#Prerelease_Versions and http://docs.nuget.org/docs/release-notes/nuget-1.7#Show_prerelease_packages_in_the_Manage_NuGet_packages_dialog

Pre-requisites for this release

  • If you are using Visual Studio 2012, please download“ASP.NET and Web Tools 2013.1 for Visual Studio 2012”.
  • If you are using Visual Studio 2013, please download“Visual Studio 2013 Update 1 RC”. This update is needed for editing ASP.NET MVC 5.1 Razor Views.

What’s in the release?

You can find a complete listing of the features and fixes included in this release by referring to the release notes.

Check out some highlights of the new features included in this release below.

ASP.NET MVC 5.1

Attribute Routing

Attribute routing now supports constraints, enabling versioning and header based route selection. There's a Web API-based sample here: (https://aspnet.codeplex.com/SourceControl/latest#Samples/WebApi/RoutingConstraintsSample/ReadMe.txt); the concepts are the same as MVC.

Bootstrap support in HTML Helpers

We now allow passing in html attributes in Html.EditorFor as an anonymous object. This means you can pass in Bootstrap styles in HtmlHelpers and style the various input elements such as textboxes, dropdownlist etc. with the correct Bootstrap styles.

Support for Enums

We have added support in ASP.NET MVC 5.1 for using Enum Types in MVC views. We have added a new HTML Helper Html.EnumDropDownListFor() which will generate a dropdown when binding to Enum Types. For eg. if you have an Enum as follows.

Code Snippet
  1. publicenumMyEnum
  2. {
  3.     Sunday = 1,
  4.     Monday = 2
  5. }
  6.  
  7. publicclassTest
  8. {
  9.     publicint Id { get; set; }
  10.     publicstring MyProperty { get; set; }
  11.     publicMyEnum MyEnum { get; set; }
  12. }

When you use the EnumDropDownListFor Helper, it will generate the following view when you are creating an Enum. You can see a full sample at: https://aspnet.codeplex.com/SourceControl/latest#Samples/MVC/EnumSample/

image

ASP.NET Web API 2.1

Global Error Handling

In ASP.NET Web API, there is a centralized way to logged all unhandled exceptions. You can also use Logging frameworks such as ELMAH to log all exceptions from Web API to ELMAH.  You can look at a sample https://aspnet.codeplex.com/SourceControl/latest#Samples/WebApi/Elmah/ReadMe.txt

Attribute Routing

Attribute routing now supports constraints, enabling versioning and header based route selection. Many aspects of attribute routes are now customizable via the IDirectRouteProvider interface andRouteProviderAttribute class. The route prefix is now extensible via the IRoutePrefix interface and RoutePrefixAttribute class.

There's a Web API-based sample here (https://aspnet.codeplex.com/SourceControl/latest#Samples/WebApi/RoutingConstraintsSample/ReadMe.txt).

BSON media type formatter

We now support the BSON wire format both on the client and on the server assemblies. See a full sample at: https://aspnet.codeplex.com/SourceControl/latest#Samples/WebApi/BSONSample/

Support for Async filters

Web API now supports an easy way for authoring async filters. If your filter needs to access a database or do some async work, you can override the new virtual On*Async methods like the sample action filter below.

Code Snippet
  1. publicclassAsyncLoggingFilter : ActionFilterAttribute
  2.         {
  3.             publicoverrideasync Task OnActionExecutingAsync(HttpActionContext actionContext, CancellationToken cancellationToken)
  4.             {
  5.                 await Trace.WriteAsync("Executing action named {0} for request {1}.",
  6.                     actionContext.ActionDescriptor.ActionName,
  7.                     actionContext.Request.GetCorrelationId());
  8.             }
  9.         }

Query parsing support for the client formatting library

System.Net.Http.Formatting supported query parsing and query update for server side code, but the equivalent portable was missing this feature. In 5.1, a client application can now easily parse and update a query string.

Help Page Improvements

We have improved the Help Page feature in ASP.NET Web API so that the Help Page can provide more information such as :

  • Documentation of individual properties of parameters or return types of actions.
  • Documentation of data model annotations.
  • User interface design change to accommodate the above changes.
  • For eg. if you are returning a Course resource as shown below, the Help Page will give you additional information about the Course type.

    clip_image002

    clip_image004

Give feedback

If you have any issues with ASP.NET MVC, Web API and Web Pages, please open issues on the CodePlex site (https://aspnetwebstack.codeplex.com/workitem/list/basic). For any discussions on these features please discuss them in the ASP.NET forums. For ASP.NET MVC, please see http://forums.asp.net/1146.aspx/1?MVC and Web API http://forums.asp.net/1246.aspx/1?Web+API

Overall list of fixed issues in this release

We also made several bug fixes as a part of this release. You can find the complete list for ASP.NET MVC, Web API and Web Pages here.


Viewing all articles
Browse latest Browse all 7144

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>