what’s new in asp.net mvc 3 building a nerddinner/appstore application
TRANSCRIPT
![Page 1: What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application](https://reader038.vdocuments.site/reader038/viewer/2022110400/56649db65503460f94aa869f/html5/thumbnails/1.jpg)
What’s new inASP.NET MVC 3
Building a NerdDinner/AppStore
Application
![Page 2: What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application](https://reader038.vdocuments.site/reader038/viewer/2022110400/56649db65503460f94aa869f/html5/thumbnails/2.jpg)
Introducing NerdDinner.com
![Page 3: What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application](https://reader038.vdocuments.site/reader038/viewer/2022110400/56649db65503460f94aa869f/html5/thumbnails/3.jpg)
Introducing NerdDinner.com
• nerddinner.codeplex.com• Free PDF walkthrough (updated to
2.0)– tinyurl.com/aspnetmvc
![Page 4: What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application](https://reader038.vdocuments.site/reader038/viewer/2022110400/56649db65503460f94aa869f/html5/thumbnails/4.jpg)
Introducing NerdDinner.com
![Page 5: What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application](https://reader038.vdocuments.site/reader038/viewer/2022110400/56649db65503460f94aa869f/html5/thumbnails/5.jpg)
Introducing NerdDinner.com
![Page 6: What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application](https://reader038.vdocuments.site/reader038/viewer/2022110400/56649db65503460f94aa869f/html5/thumbnails/6.jpg)
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 HelpersImproved
Dependency Injection
Porting MVC Script Libraries to jQuery
Granular ValidateInput
Add View Dialog Improvements
Project Dialog Extensibility
Improvements
Improved Caching Support
JSON Binding Support
![Page 7: What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application](https://reader038.vdocuments.site/reader038/viewer/2022110400/56649db65503460f94aa869f/html5/thumbnails/7.jpg)
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 HelpersImproved
Dependency Injection
Porting MVC Script Libraries to jQuery
Granular ValidateInput
Add View Dialog Improvements
Project Dialog Extensibility
Improvements
Improved Caching Support
JSON Binding Support
![Page 8: What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application](https://reader038.vdocuments.site/reader038/viewer/2022110400/56649db65503460f94aa869f/html5/thumbnails/8.jpg)
Upgrading
ASP.NET MVC 3 Application Upgrader
tinyurl.com/upgrademvc3
![Page 9: What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application](https://reader038.vdocuments.site/reader038/viewer/2022110400/56649db65503460f94aa869f/html5/thumbnails/9.jpg)
Multiple View Engine Support
![Page 10: What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application](https://reader038.vdocuments.site/reader038/viewer/2022110400/56649db65503460f94aa869f/html5/thumbnails/10.jpg)
Multiple View Engine Support
protected void Application_Start(){ ViewEngines.Engines.Add(new SparkViewFactory()); …}
![Page 11: What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application](https://reader038.vdocuments.site/reader038/viewer/2022110400/56649db65503460f94aa869f/html5/thumbnails/11.jpg)
Razor
• Clean & Concise• Based on Existing Languages• Intellisense• Code Colorization• Unit Testing Support
![Page 12: What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application](https://reader038.vdocuments.site/reader038/viewer/2022110400/56649db65503460f94aa869f/html5/thumbnails/12.jpg)
Syntax Comparison
Web Forms6 transitions
Razor2 transitions
<ul>@for (int i = 0; i < 10; i++){ <li>@i</li>}</ul>
<ul><% for (int i = 0; i < 10; i++) {%> <li><%=i %></li><%} %></ul>
![Page 13: What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application](https://reader038.vdocuments.site/reader038/viewer/2022110400/56649db65503460f94aa869f/html5/thumbnails/13.jpg)
Layouts
Layout View<html>
<head>
<title>Title<title></head><body>
@RenderSection("Menu")@RenderBody()
</body></html>
@{Layout="~/Views/Shared/
_Layout.cshtml";}@section Menu {
<ul id="pageMenu"><li>Item 1</li><li>Item 2</li>
</ul>}
![Page 14: What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application](https://reader038.vdocuments.site/reader038/viewer/2022110400/56649db65503460f94aa869f/html5/thumbnails/14.jpg)
Web Forms to Razor
Open Source Razor Converter
github.com/telerik/razor-converter
![Page 15: What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application](https://reader038.vdocuments.site/reader038/viewer/2022110400/56649db65503460f94aa869f/html5/thumbnails/15.jpg)
DEMO
Views using Razor
![Page 16: What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application](https://reader038.vdocuments.site/reader038/viewer/2022110400/56649db65503460f94aa869f/html5/thumbnails/16.jpg)
Filters
• Declarative• Cross-cutting concerns• Custom filters• Supported since version 1
![Page 17: What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application](https://reader038.vdocuments.site/reader038/viewer/2022110400/56649db65503460f94aa869f/html5/thumbnails/17.jpg)
Types of Filters
• IActionFilter• IResultFilter• IExceptionFilter• IAuthorizationFilter
![Page 18: What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application](https://reader038.vdocuments.site/reader038/viewer/2022110400/56649db65503460f94aa869f/html5/thumbnails/18.jpg)
Filters Example
[HandleError]public class BlogController : Controller{
[HandleLogging]public ActionResult Index(){ return View(); }
}
![Page 19: What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application](https://reader038.vdocuments.site/reader038/viewer/2022110400/56649db65503460f94aa869f/html5/thumbnails/19.jpg)
Global Filters
• No longer need attributes• Applies to all actions on all
controllers
![Page 20: What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application](https://reader038.vdocuments.site/reader038/viewer/2022110400/56649db65503460f94aa869f/html5/thumbnails/20.jpg)
Global Filters
protected void Application_Start(){ GlobalFilters.Filters.Add(new MyActionFilterAttribute()); …}
![Page 21: What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application](https://reader038.vdocuments.site/reader038/viewer/2022110400/56649db65503460f94aa869f/html5/thumbnails/21.jpg)
DEMO
Logging Errors with Global Filters
![Page 22: What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application](https://reader038.vdocuments.site/reader038/viewer/2022110400/56649db65503460f94aa869f/html5/thumbnails/22.jpg)
Dynamic ViewBag
• Accessible via properties• Properties map to ViewData entries• Late-bound
![Page 23: What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application](https://reader038.vdocuments.site/reader038/viewer/2022110400/56649db65503460f94aa869f/html5/thumbnails/23.jpg)
Dynamic ViewBag
<head>
<title>@ViewBag.Title<title></head>
![Page 24: What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application](https://reader038.vdocuments.site/reader038/viewer/2022110400/56649db65503460f94aa869f/html5/thumbnails/24.jpg)
DEMO
Converting to Dynamic ViewBag
![Page 25: What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application](https://reader038.vdocuments.site/reader038/viewer/2022110400/56649db65503460f94aa869f/html5/thumbnails/25.jpg)
New Action Results
• HttpNotFoundResult• RedirectResult• HttpStatusCodeResult
![Page 26: What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application](https://reader038.vdocuments.site/reader038/viewer/2022110400/56649db65503460f94aa869f/html5/thumbnails/26.jpg)
DEMO
Using New Action Results
![Page 27: What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application](https://reader038.vdocuments.site/reader038/viewer/2022110400/56649db65503460f94aa869f/html5/thumbnails/27.jpg)
JavaScript and AJAX
• JSON Binding• jQuery Validation• Unobstrusive JavaScript– Separation of Presentation and Content– No errors if AJAX isn’t supported
• RemoteAttribute
![Page 28: What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application](https://reader038.vdocuments.site/reader038/viewer/2022110400/56649db65503460f94aa869f/html5/thumbnails/28.jpg)
Unobtrusive JavaScript
HtmlHelper.UnobtrusiveJavaScriptEnabled = true;
code
<configuration> <appSettings>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/> </appSettings></configuration>
web.config
![Page 29: What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application](https://reader038.vdocuments.site/reader038/viewer/2022110400/56649db65503460f94aa869f/html5/thumbnails/29.jpg)
Unobtrusive JavaScript
HtmlHelper.UnobtrusiveJavaScriptEnabled = true;
code
<configuration> <appSettings>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/> </appSettings></configuration>
web.config
![Page 30: What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application](https://reader038.vdocuments.site/reader038/viewer/2022110400/56649db65503460f94aa869f/html5/thumbnails/30.jpg)
Client Validation
HtmlHelper. ClientValidationEnabled = true;
code
<configuration> <appSettings>
<add key=“ClientValidationEnabled" value="true"/> </appSettings></configuration>
web.config
![Page 31: What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application](https://reader038.vdocuments.site/reader038/viewer/2022110400/56649db65503460f94aa869f/html5/thumbnails/31.jpg)
DEMO
Remote Validation
![Page 32: What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application](https://reader038.vdocuments.site/reader038/viewer/2022110400/56649db65503460f94aa869f/html5/thumbnails/32.jpg)
ResourcesSoftware Application
Developers
http://msdn.microsoft.com/
Infrastructure Professionals
http://technet.microsoft.com/
msdnindia technetindia @msdnindia @technetindia
![Page 33: What’s new in ASP.NET MVC 3 Building a NerdDinner/AppStore Application](https://reader038.vdocuments.site/reader038/viewer/2022110400/56649db65503460f94aa869f/html5/thumbnails/33.jpg)
© 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.