250 likes | 327 Views
WEB309 What’s new in ASP.NET MVC 3. Jonathan Carter Microsoft Corporation joncart@microsoft.com www.lostintangent.com @lostintangent. Disclaimer. This talk requires a really good understanding of ASP.NET MVC 1 & 2. Agenda. The title of the talk says it all…. What’s new in ASP.NET MVC 3?.
E N D
WEB309What’s new in ASP.NET MVC 3 Jonathan Carter Microsoft Corporation joncart@microsoft.com www.lostintangent.com @lostintangent
Disclaimer This talk requires a really good understanding of ASP.NET MVC 1 & 2
Agenda The title of the talk says it all…
Package management • “Simplified” view development • Improved testability • Global filters
Find it on the web • Download the bits • Add any assembly references • Add any other code files • Modify the web.config if neccesary • Repeat 1-5 for dependencies • Scream!
Demo NUGET
View Development: Favoring essence over ceremony…
View Template Options <ul> <%for (int i = 0; i < 10; i++) { %> <li><%=i%></li> <%}%> </ul> Web Forms (6 transitions): <ul> @for (int i = 0; i < 10; i++) { <li>@i</li> } </ul> Razor (2 transitions):
Code <-> Markup @{ var name = “John Doe”; <div> Your name: @name </div> } Option 1: HTML Block @{ var name = “John Doe”; <text> Your name: @name </text> } Option 2: Text Block @{ var name = “John Doe”; } @: Your name: @name Option 3: Single line of output in markup
Layouts /Shared/_Layout.cshtml • <html> • <head> • <title>Simple Layout</title> • </head> • <body> • @RenderBody() • </body> • </html> MyPage.cshtml • @{ • Layout = "/Shared/_Layout.cshtml"; • } • <p> • My content goes here • </p>
Sections /Shared/_Layout.cshtml MyPage.cshtml • <html> • <head> • <title>Simple Layout</title> • </head> • <body> • @RenderSection("Menu") • @RenderBody() • </body> • </html> • @{ • Layout = "/Shared/_Layout.cshtml"; • } • @section Menu { • <ulid="pageMenu"> • <li>Option 1</li> • <li>Option 2</li> • </ul> • } • <p> • My content goes here • </p>
Helpersof course! • “Controls” (e.g. WebGrid) • Facebook • Twitter • PayPal • UserVoice • OData • Windows Azure Storage • Etc.
Demo Razor
Have you had issues with decoupling your app from dependencies?
Pick your favorite DI container • Register your dependencies • Register it with MVC • Write awesomely decoupled code
Demo Dependency RESOLUTION
Demo Global filters
Session Evaluations Tell us what you think, and you could win! All evaluations submitted are automatically entered into a daily prize draw* Sign-in to the Schedule Builder at http://europe.msteched.com/topic/list/ * Details of prize draw rules can be obtained from the Information Desk.
© 2010 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.