1. What’s new in Mvc 4
By Brandon D’Imperio
Imaginarydevelopment.blogspot.com
2. Asp.Net 4.5 new features
• Bundling
– Script
– CSS
• Mobile features
– New mobile project template
– Many new features to support mobile apps
• Async Handlers/Modules
• Performance
• _references.js - sweet
3. Mvc 4 new stuff
• ASP.NET Web API
• Full Async support for actions
– Async<ActionResult> Index(){Return View();}
• Refreshed and modernized default project
templates
4. Bundling
Impact of Bundling and Minification
Using B/M Without B/M Change
File Requests 9 34 256%
KB Sent 3.26 11.92 266%
KB Received 388.51 530 36%
Load Time 510 MS 780 MS 53%
5. Modernized Project Template
• OAuth and OpenID support enabled
• Html5 by default
• Uses jQueryUI for login
• Includes KnockoutJs
• adaptive rendering - looks good in both
desktop browsers and mobile browsers
without any customization
• Bundling/minification built-in
• Includes WebApi Plumbing (or templates)
– Query composition: Use the [Queryable] filter
attribute on an action that
returns IQueryable to enable support for
querying your web API via the OData query
conventions.
7. Little known or used Mvc
features not specific to 4
Views
Helpers
Collection.cshtml
ModelBinding – complex nested type?
Let json bind that sucker
8. Little known sources
• http://weblogs.asp.net/scottgu/archive/2011/
05/12/asp-net-mvc-3-and-the-helper-syntax-
within-razor.aspx
Editor's Notes
http://www.asp.net/whitepapers/mvc4-release-notesPerformance is a new feature, per Jon Galloway - http://www.slideshare.net/jongalloway
Sample code is not guaranteed to compile
http://www.asp.net/mvc/tutorials/mvc-4/bundling-and-minificationThe bytes sent had a significant reduction with bundling as browsers are fairly verbose with the HTTP headers they apply on requests. The received bytes reduction is not as large because the largest files (Scripts\\jquery-ui-1.8.11.min.js and Scripts\\jquery-1.7.1.min.js) are already minified. Note: The timings on the sample program used theFiddler tool to simulate a slow network. (From the Fiddler Rules menu, select Performance then Simulate Modem Speeds.)