What’s new in ASP.NET MVC 4 Simone Chiaretta Architect, Council of the EU http://codeclimber.net.nz Twitter: @simonech
Who am I? ► Simone Chiaretta ► Microsoft MVP ASP.NET ► ASP Insider ► Blogger – http://codeclimber.net.nz ► Moved to Belgium ► Contributor to various OpenSource projects ► Runner/Climber/Triathlete Disclaimer:"The views expressed are purely those of the speaker and may not in any circumstances be regarded as stating an official position of the Council"
ASP.NET MVC 4 Goals ► Enhance development and deployment ► Bring together all MS Web Stack ► Better HTML5 / Mobile support ► Cloud ready
ASP.NET MVC 4 ► New and refreshed Project Template ► Enhanced support for mobile sites ► Recipes for custom code generation ► Improved support for async controllers ► Cloud-ready
ASP.NET MVC 4 – Developer Preview ► Released September 2011 @ Build ► Both for .NET 4 and .NET 4.5 preview ► Downloadable with Web Platform Installer 4
New Project Template ► New look closer to ASP.NET website ► HTML5 by default ► Responsive Design (via media queries) ► Uses jQueryUI for the login ► Includes KnockOutJS
Support for Mobile Sites ► New Mobile Project Template for mobile-only sites ► Display modes – Views/index.cshtml – Views/index.mobile.cshtml ► Inclusion of jQuery Mobile ► View Switcher and Browser Overriding
Recipes ► Custom code-generation plugins ► Downloadable via NuGet ► Still a bit undocumented ► Heavily rely on VS Extensibility
Recipes How-To ► Class library ► Reference Microsoft.VisualStudio.Mvc.Extensibility.1.0. dll ► Implement IRecipe or IFolderRecipe ► Build your own custom UI Dialog ► Package and deploy with NuGet Or Install Package AspNetMvc4.RecipeSdk
Task based Async Controllers ► Single Method Async Contollers ► No more manual handling of requests ► Returns Task<ActionResult> MVC3 public void SyncAllAsync() { AsyncManager.OutstandingOperations.Increment(); MVC4 StuffService stuff = new StuffService(); stuff.StuffCompleted += (sender, e) => public Task<ActionResult> SyncAllAsync(){ MVC4 + C#5 (or Async CTP) { AsyncManager.Parameters["model"] = e.Result; StuffService stuff = new StuffService();AsyncManager.OutstandingOperations.Decrement(); }; return stuff.DoStuffAsync() stuff.DoStuffAsync("Some other => { .ContinueWith(t stuff"); } return View(t.Result) public async Task<ActionResult> SyncAllAsync() { }); public ActionResult SyncAllCompleted(SyncViewModel model) } { StuffService stuff = new StuffService(); return View(model); stuff.DoStuffAsync()); return View(await } }
Looking at the future ► Better integration with other “products” – Web Pages 2 – ASP.NET 4.5 – Web API
Minification & Bundling View <script src=“/Scripts/js”></scripts> Global.asax BundleTable.Bundles.EnableDefaultBundles();
WCF WebAPI Preview 6 ► Uses WCF syntax for web API ► Returns JSON or XML ► Extensible
Summary ► MVC4 introduced new mobile features, better aync, enhanced tooling ► Current release is a Developer Preview from BUILD (4 months ago) ► Beta coming in the next few months ► Final release in sync with next release of Visual Studio vNext (Dev11)
References ► MVC 4 Main Page and Dev Preview http://www.asp.net/mvc/mvc4 ► Release Notes http://www.asp.net/whitepapers/mvc4-release-notes ► Roadmap http://aspnet.codeplex.com/wikipage?title=ASP.NET%20MVC%204%20RoadMap ► Phil Haack’s Mobility Talk, BUILD Sep 2011 http://channel9.msdn.com/events/BUILD/BUILD2011/TOOL-803T ► Create an MVC4 Recipe http://haacked.com/archive/2011/09/22/writing-a-recipe-for-asp-net- mvc-4-developer-preview.aspx ► The evolution of Async controllers in ASP.NET MVC http://codeclimber.net.nz/archive/2012/01/09/evolution-of-async- controller-asp-net-mvc.aspx
Contacts – Simone Chiaretta ► Blog: http://codeclimber.net.nz/ ► Twitter: @simonech 15
© 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

What's new in asp.net mvc 4

  • 1.
    What’s new inASP.NET MVC 4 Simone Chiaretta Architect, Council of the EU http://codeclimber.net.nz Twitter: @simonech
  • 2.
    Who am I? ► Simone Chiaretta ► Microsoft MVP ASP.NET ► ASP Insider ► Blogger – http://codeclimber.net.nz ► Moved to Belgium ► Contributor to various OpenSource projects ► Runner/Climber/Triathlete Disclaimer:"The views expressed are purely those of the speaker and may not in any circumstances be regarded as stating an official position of the Council"
  • 3.
    ASP.NET MVC 4Goals ► Enhance development and deployment ► Bring together all MS Web Stack ► Better HTML5 / Mobile support ► Cloud ready
  • 4.
    ASP.NET MVC 4 ► New and refreshed Project Template ► Enhanced support for mobile sites ► Recipes for custom code generation ► Improved support for async controllers ► Cloud-ready
  • 5.
    ASP.NET MVC 4– Developer Preview ► Released September 2011 @ Build ► Both for .NET 4 and .NET 4.5 preview ► Downloadable with Web Platform Installer 4
  • 6.
    New Project Template ► New look closer to ASP.NET website ► HTML5 by default ► Responsive Design (via media queries) ► Uses jQueryUI for the login ► Includes KnockOutJS
  • 7.
    Support for MobileSites ► New Mobile Project Template for mobile-only sites ► Display modes – Views/index.cshtml – Views/index.mobile.cshtml ► Inclusion of jQuery Mobile ► View Switcher and Browser Overriding
  • 8.
    Recipes ► Custom code-generation plugins ► Downloadable via NuGet ► Still a bit undocumented ► Heavily rely on VS Extensibility
  • 9.
    Recipes How-To ► Class library ► Reference Microsoft.VisualStudio.Mvc.Extensibility.1.0. dll ► Implement IRecipe or IFolderRecipe ► Build your own custom UI Dialog ► Package and deploy with NuGet Or Install Package AspNetMvc4.RecipeSdk
  • 10.
    Task based AsyncControllers ► Single Method Async Contollers ► No more manual handling of requests ► Returns Task<ActionResult> MVC3 public void SyncAllAsync() { AsyncManager.OutstandingOperations.Increment(); MVC4 StuffService stuff = new StuffService(); stuff.StuffCompleted += (sender, e) => public Task<ActionResult> SyncAllAsync(){ MVC4 + C#5 (or Async CTP) { AsyncManager.Parameters["model"] = e.Result; StuffService stuff = new StuffService();AsyncManager.OutstandingOperations.Decrement(); }; return stuff.DoStuffAsync() stuff.DoStuffAsync("Some other => { .ContinueWith(t stuff"); } return View(t.Result) public async Task<ActionResult> SyncAllAsync() { }); public ActionResult SyncAllCompleted(SyncViewModel model) } { StuffService stuff = new StuffService(); return View(model); stuff.DoStuffAsync()); return View(await } }
  • 11.
    Looking at thefuture ► Better integration with other “products” – Web Pages 2 – ASP.NET 4.5 – Web API
  • 12.
    Minification & Bundling View <script src=“/Scripts/js”></scripts> Global.asax BundleTable.Bundles.EnableDefaultBundles();
  • 13.
    WCF WebAPI Preview6 ► Uses WCF syntax for web API ► Returns JSON or XML ► Extensible
  • 14.
    Summary ► MVC4 introduced new mobile features, better aync, enhanced tooling ► Current release is a Developer Preview from BUILD (4 months ago) ► Beta coming in the next few months ► Final release in sync with next release of Visual Studio vNext (Dev11)
  • 15.
    References ► MVC 4 Main Page and Dev Preview http://www.asp.net/mvc/mvc4 ► Release Notes http://www.asp.net/whitepapers/mvc4-release-notes ► Roadmap http://aspnet.codeplex.com/wikipage?title=ASP.NET%20MVC%204%20RoadMap ► Phil Haack’s Mobility Talk, BUILD Sep 2011 http://channel9.msdn.com/events/BUILD/BUILD2011/TOOL-803T ► Create an MVC4 Recipe http://haacked.com/archive/2011/09/22/writing-a-recipe-for-asp-net- mvc-4-developer-preview.aspx ► The evolution of Async controllers in ASP.NET MVC http://codeclimber.net.nz/archive/2012/01/09/evolution-of-async- controller-asp-net-mvc.aspx
  • 16.
    Contacts – SimoneChiaretta ► Blog: http://codeclimber.net.nz/ ► Twitter: @simonech 15
  • 17.
    © 2011 MicrosoftCorporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Editor's Notes

  • #6 Show creation of new site with the new project template, and show how the responsive design is implemented (via media queries)@media only screen and (max-width: 850px) {
  • #7 Create a new project based on the mobile project template for mobile only sitesThen go back to the other project and show how to add mobile views
  • #8 Imagine you want to create a page using jqGrid or want to get data from a specific JSON based api: with recipes you could automate all the repetitive coding and collect inputs via custom dialogs.
  • #12 Bundling: just add BundleTable.Bundles.EnableDefaultBundles(); toGlobal.asax