Jean-Claude Trachsel Senior Consultant Trivadis AG
Agenda Overview New Features Summary
ASP.NET MVC 3
It can be installed side-by-side with MVC 2 It requires the.NET Framework 4 Actual release is Beta
Global Filters Dynamic ViewModel Property New ActionResult Types Model Validation Support Ajax and jQuery Support Dependency Injection Support Razor View Engine
New possibility to apply a filter to all controllers Conditional filters thru IFilterProvider
Uses.NET 4 dynamic datatype Cleaner solution to work with the ViewModel No strings as key anymore
ViewData vs. ViewModel ViewData["Message"]="Welcome to ASP.NET MVC!"; ViewModel.Message="Welcome to ASP.NET MVC MVC 3 MVC 2
HttpNotFoundResult HttpRedirectResult HttpStatusCodeResult
HttpNotFoundResult public ActionResult About() { return HttpNotFound(); }
Model Validation Supports new.Net 4 DataAnnotations Features DisplayAttribute New IsValid overloads in the ValidationAttribute IValidatableObject
Ajax and jQuery Many new Ajax and jQuery features Visit the afternoon session ASP.NET MVC 3 specific JsonValueProviderFactory
Form & Fields Step 1 Edit fields on the form in the browser
Post Form & Fields Controller Action Controller Action Step 2 Post the form to the server. The routing engine calls the controller
Post Form & Fields Controller Action Controller Action Object & Property Model Binder Step 3 Instanciate the entity object and set properties to the form values
Form & Fields Step 1 Edit fields on the form in the browser
jQuery Form & Fields Step 2 Generate Json object on the client with jQuery Json
Ajax Post Ajax Post Form & Fields Controller Action Controller Action Step 3 Post the Json object asynchron to the server
Post Form & Fields Controller Action Controller Action Object & Property Jason Value Provider Jason Value Provider Step 4 Instanciate the entity object and set properties to the json values
Dependency Injection ASP.NET MVC 3 supports Common Service Locator library Any DI container supporting it’s IServiceLocator interface Common Service Locator library is supported by Unity Spring.NET Castle Windsor StructureMap
MVC 3 DI support MVC 3 beta Controllers (registering & injecting controller factories, injecting controllers) Views (registering & injecting view engines, injecting dependencies into view pages) Action Filters (locating & injecting filters) MVC 3 RC Model Binders (registering & injecting) Value Providers (registering & injecting) Validation Providers (registering & injecting) Model metadata Providers (registering & injecting)
View Engines ASP.NET (aspx) * Razor * Spark NHaml NDjango * Included in Visual Studio 2010
Compact, Expressive and Fluid Easy to learn Is not a new language Works with any Text Editor Has great Intellisense and syntax highlighting
Razor advantages 1 character instead of 5 for code blocks (no closing tag needed) Parser has semantic knowledge of C# / VB Aspx: Coding is fast, fluid and fun
«Hello World» " %> Razor Demo Razor Demo Hello World, we got Number 1: and Number = "Razor Demo";} Razor Demo Hello World, we got Number and Number Razor aspx
Razor syntax Multiline statements if(){}, foreach(){} Layout/MasterPage concept _viewstart.cshtml concept
Summary Many helpful new features Great IoC and DI support Perfect Data Annotations support Razor, a clean, fast and fun approach
Termin: Ort: Zürich - in der Trivadis Niederlassung Agenda: 16:00 h: Registrierung und Begrüssungskaffee 16:30 h: Silverlight, Azure and WP7 17:30 h: Pause mit Verpflegung 18:00 h: Keynote PDC10 mit Steve Ballmer 20:00 h: Pause mit Verpflegung 20:30 h: Podiumsdiskussion: "Was bedeuten die Ankündigung für die Praxis" 21:30 h: Verlosung der Preise
© 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.