Presentation is loading. Please wait.

Presentation is loading. Please wait.

What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application.

Similar presentations


Presentation on theme: "What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application."— Presentation transcript:

1 What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application

2 Introducing NerdDinner.com

3 nerddinner.codeplex.com Free PDF walkthrough (updated to 2.0) –tinyurl.com/aspnetmvc

4 Introducing NerdDinner.com

5

6 What’s new in ASP.NET MVC 3 Razor View Engine Multiple View Engine Support Validation Improvements Dynamic ViewBag Global Filters New ActionResults Project Dialog Improvements VBHTML Support Task-based Helpers Improved Dependency Injection Porting MVC Script Libraries to jQuery Granular ValidateInput Add View Dialog Improvements Project Dialog Extensibility Improvements Improved Caching Support JSON Binding Support

7 What’s new in ASP.NET MVC 3 Razor View Engine Multiple View Engine Support Validation Improvements Dynamic ViewBag Global Filters New ActionResults Project Dialog Improvements VBHTML Support Task-based Helpers Improved Dependency Injection Porting MVC Script Libraries to jQuery Granular ValidateInput Add View Dialog Improvements Project Dialog Extensibility Improvements Improved Caching Support JSON Binding Support

8 Upgrading ASP.NET MVC 3 Application Upgrader tinyurl.com/upgrademvc3

9 Multiple View Engine Support

10 protected void Application_Start() { ViewEngines.Engines.Add(new SparkViewFactory()); … } protected void Application_Start() { ViewEngines.Engines.Add(new SparkViewFactory()); … }

11 Razor Clean & Concise Based on Existing Languages Intellisense Code Colorization Unit Testing Support

12 Syntax Comparison Web Forms 6 transitions Razor 2 transitions @for (int i = 0; i < 10; i++) { @i } @for (int i = 0; i < 10; i++) { @i }

13 Layouts LayoutView Title @RenderSection("Menu") @RenderBody() Title @RenderSection("Menu") @RenderBody() @{ Layout="~/Views/Shared/_Layout.cshtml"; } @section Menu { Item 1 Item 2 } @{ Layout="~/Views/Shared/_Layout.cshtml"; } @section Menu { Item 1 Item 2 }

14 Web Forms to Razor Open Source Razor Converter github.com/telerik/razor-converter

15 DEMO Views using Razor

16 Filters Declarative Cross-cutting concerns Custom filters Supported since version 1

17 Types of Filters IActionFilter IResultFilter IExceptionFilter IAuthorizationFilter

18 Filters Example [HandleError] public class BlogController : Controller { [HandleLogging] public ActionResult Index() { return View(); } } [HandleError] public class BlogController : Controller { [HandleLogging] public ActionResult Index() { return View(); } }

19 Global Filters No longer need attributes Applies to all actions on all controllers

20 Global Filters protected void Application_Start() { GlobalFilters.Filters.Add(new MyActionFilterAttribute()); … } protected void Application_Start() { GlobalFilters.Filters.Add(new MyActionFilterAttribute()); … }

21 DEMO Logging Errors with Global Filters

22 Dynamic ViewBag Accessible via properties Properties map to ViewData entries Late-bound

23 Dynamic ViewBag @ViewBag.Title @ViewBag.Title

24 DEMO Converting to Dynamic ViewBag

25 New Action Results HttpNotFoundResult RedirectResult HttpStatusCodeResult

26 DEMO Using New Action Results

27 JavaScript and AJAX JSON Binding jQuery Validation Unobstrusive JavaScript –Separation of Presentation and Content –No errors if AJAX isn’t supported RemoteAttribute

28 Unobtrusive JavaScript HtmlHelper.UnobtrusiveJavaScriptEnabled = true; code web.config

29 Unobtrusive JavaScript HtmlHelper.UnobtrusiveJavaScriptEnabled = true; code web.config

30 Client Validation HtmlHelper. ClientValidationEnabled = true; code web.config

31 DEMO Remote Validation

32 Resources Software Application Developers http://msdn.microsoft.com/ Infrastructure Professionals http://technet.microsoft.com/ msdnindia technetindia @msdnindia @technetindia

33 © 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.


Download ppt "What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application."

Similar presentations


Ads by Google