1 / 30

ASP.NET MVC 3

ASP.NET MVC 3. Jean-Claude Trachsel. Senior Consultant. Trivadis AG. Agenda. Overview N ew Features Summary. ASP.NET MVC 3. ASP.NET MVC 3 Many new Features. ASP.NET MVC 2 More Productivity , Security and Performance. ASP.NET MVC 1 Basic Features. ASP.NET MVC 1 Basic Features.

camdyn
Download Presentation

ASP.NET MVC 3

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ASP.NET MVC 3 Jean-Claude Trachsel Senior Consultant Trivadis AG

  2. Agenda • Overview • New Features • Summary

  3. ASP.NET MVC 3 ASP.NETMVC 3 Manynew Features ASP.NET MVC 2 More Productivity, Security and Performance ASP.NET MVC 1 Basic Features ASP.NET MVC 1 Basic Features

  4. ASP.NET MVC 3 • It can be installed side-by-side with MVC 2 • It requires the .NET Framework 4 • Actual release is Beta

  5. Manynew FeaturesAndmanymore… • Global Filters • Dynamic ViewModel Property • New ActionResultTypes • Model Validation Support • Ajax andjQuery Support • DependencyInjection Support • Razor View Engine

  6. Global FiltersAspect Oriented Programing • New possibility to apply a filter to all controllers • Conditional filters thruIFilterProvider Demo

  7. ViewModelNew Dynamic Property • Uses .NET 4 dynamicdatatype • Cleaner solutiontoworkwiththeViewModel • Nostringsaskeyanymore

  8. ViewData vs. ViewModel ViewData["Message"]="Welcome to ASP.NET MVC!"; <div><%:ViewContext.ViewData["Message"]%></div> ViewModel.Message="Welcome to ASP.NET MVC 3!"; <div>@View.Message</div> MVC 2 MVC 3

  9. ActionResultNew Types • HttpNotFoundResult • HttpRedirectResult • HttpStatusCodeResult

  10. HttpNotFoundResult publicActionResultAbout() { returnHttpNotFound(); }

  11. Model Validation • Supports new .Net 4 DataAnnotations Features • DisplayAttribute • New IsValidoverloads in theValidationAttribute • IValidatableObject Demo

  12. Ajax andjQuery • Many new Ajax and jQueryfeatures • Visittheafternoonsession • ASP.NET MVC 3 specific • JsonValueProviderFactory

  13. Model bindingsupportASP.NET MVC 2 Form&Fields Step 1 Edit fields on the form in thebrowser

  14. Model bindingsupportASP.NET MVC 2 Form&Fields Controller Action Post Step 2 Post the form totheserver. The routingenginecallsthecontroller

  15. Model bindingsupportASP.NET MVC 2 Form&Fields Controller Action Object& Property Post ModelBinder Step 3 Instanciatetheentityobjectandsetpropertiestothe form values

  16. JsonbindingsupportASP.NET MVC 3 Form&Fields Step 1 Edit fields on the form in thebrowser

  17. JsonbindingsupportASP.NET MVC 3 Json Form&Fields jQuery Step 2 GenerateJsonobject on theclientwithjQuery

  18. JsonbindingsupportASP.NET MVC 3 Form&Fields Controller Action Ajax Post Step 3 Post theJsonobjectasynchron totheserver

  19. JsonbindingsupportASP.NET MVC 3 Form&Fields Controller Action Object&Property Post Jason Value Provider Step 4 Instanciatetheentityobjectandsetpropertiestothejsonvalues

  20. DependencyInjection • ASP.NET MVC 3 supports • Common Service Locator library • Any DI container supporting it’s IServiceLocatorinterface • Common Service Locator library is supportedby • Unity • Spring.NET • Castle Windsor • StructureMap

  21. 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)

  22. View Engines • ASP.NET (aspx) * • Razor * • Spark • NHaml • NDjango * Included in Visual Studio 2010

  23. WhatisRazor?Design goalsofRazor • Compact, Expressive and Fluid • Easy to learn • Is not a new language • Works with any Text Editor • Has great Intellisense and syntax highlighting

  24. Razoradvantages • 1 characterinsteadof 5 forcodeblocks • Razor: @ (noclosing tag needed)Parser has semantic knowledge of C# / VB • Aspx: <%: %> • Coding is fast, fluid and fun

  25. «Hello World» aspx <%@PageLanguage="C#"MasterPageFile="~/Views/Shared/Site.Master“Inherits="System.Web.Mvc.ViewPage<Product>"%> <asp:ContentID="aboutTitle"ContentPlaceHolderID="TitleContent“ runat="server"> Razor Demo </asp:Content> <asp:ContentID="aboutContent"ContentPlaceHolderID="MainContent"runat="server"> <h2>Razor Demo</h2> Hello World, we got Number 1: <%: Model.Number1 %> and Number 2: <%: Model.Number1 %>. </asp:Content> @model Trivadis.Models.Product @{View.Title = "Razor Demo";} <h2>Razor Demo</h2> Hello World, we got Number 1: @Model.Number1 and Number 2: @Model.Number2. Razor

  26. Razorsyntax • Multiline statements • if(){}, foreach(){} • Layout/MasterPage concept • _viewstart.cshtmlconcept Demo

  27. Summary • Many helpful new features • Great IoC and DI support • PerfectData Annotationssupport • Razor, a clean, fast and fun approach

  28. SwissPDC10@Trivadis • Termin: 28.10.2010 • Ort: Zürich - in der Trivadis Niederlassung • Agenda: • 16:00 h: Registrierung und Begrüssungskaffee • 16:30 h: Silverlight, Azureand WP7 • 17:30 h: Pause mit Verpflegung • 18:00 h: KeynotePDC10 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

  29. Q&A

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

More Related