1 / 40

ASP.NET MVC 2

ASP.NET MVC 2. The good news. Jean-Claude Trachsel Senior Consultant, Trivadis AG j ean-claude.trachsel@trivadis.com. Agenda. What is ASP.NET MVC Features of Version 2 What about the «real life»? Summary. What is ASP.NET MVC. A short introduction.

xander
Download Presentation

ASP.NET MVC 2

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 2 The good news Jean-Claude Trachsel Senior Consultant, Trivadis AG jean-claude.trachsel@trivadis.com

  2. Agenda • What is ASP.NET MVC • Features of Version 2 • What about the «real life»? • Summary

  3. What is ASP.NET MVC A short introduction

  4. Framework based on Model-View-Controller Pattern Separation of Concerns Framework is focusing on... Pure Web Development Stateless, no ViewState Full control over markup Testability TDD, Unit Tests Maintainability Extensibility and Flexibility Modern aspects like AOP, DI, IoC What is ASP.NET MVC

  5. Positioning ASP.NET MVC • ASP.NET MVC • ASP.NET Web Forms ASP.NET Framework .NET Framework

  6. Visual Studio Template Controller and View Unit Test Demo

  7. Features of Version 2 Areas, Validation, Typed UI Helpers, etc.

  8. Goals of the DevTeam for Version 2 More Productivity More Security More Performance More Extensibility MoreHappiness  What do we get?

  9. What we will look at • Areas • Validation • Typed UI Helpers • UI Helper Templates • Async Controllers

  10. Areas Single Project and Multi Project Areas

  11. Enterprise ready with Areas Structure your Solution with... Single Project Area Multi Project Area Easy re-use of Code Areas – what for?

  12. Single Project Area Folder Structur Route Class Inherits from AreaRegistration Defines the route to the Controller Global.asax Register the area routes Areas – what’s needed?

  13. Single Project Areas Demo

  14. Validation Data Annotations Attributes

  15. Data Validation with DataAnnotations Attributes Introduced with .NET 3.5 SP 1 Benefits of DataAnnotations Attributes Set in one central place, on the model Used by different Technologies Used in ASP.NET Dynamic Data Used in WCF RIA Services ASP.NET MVC Validation

  16. Use of DataAnnotations • Set Attributes on the Model • [MetadataType(typeof(ProductMetadata))] • publicpartialclassProduct • { • } • publicclassProductMetadata • { • [Required] • publicstring Name { get; set; } • }

  17. Attributes that are available Required Range RegularExpression StringLength CustomValidation Build your own DataAnnotations

  18. Server Site Validation ModelBinder Class Client Site Validation jQuery Validation Library Validation in ASP.NET MVC

  19. Validation with DataAnnotation Attributes Server- and Client Site Demo

  20. Typed UI Helpers ...and the UI Helper Templates

  21. HtmlHelper Extensions ASP.NET MVC 1 ASP.NET MVC 2 Typed UI Helpers <%=Html.TextBox(„ProductID“,Model.ProductID)%> <%=Html.Label(„Name“,Model.Name)%> <%=Html.RadioButton(„Avail“,Model.Available)%> <%=Html.DisplayFor(p => p.ProductID)%> <%=Html.Ed itorFor(p => p.ProductID)%>

  22. Benefits are... Intellisense Compile Time Support Type based rendering Support for standard and complex types Typed UI Helpers

  23. Extend the Typed UI Helper Methods Define the Rendering via UserControls Supports standard and complex types Used by... Name Convention UI Helper Method Parameter ViewModel Attributes UI Helper Templates

  24. Typed UI Helpers UI Helper Template for DateTime Demo

  25. Async Controllers Be smart, be fast

  26. Use of Async Controller publicclassHomeController : AsyncController { publicvoidNAMEAsync() { AsyncManager.OutstandingOperations.Increment(3); // Do all Tasks asynchronouse } publicActionResultNAMECompleted(object params) { // Do final work returnView("NAME"); } }

  27. Async Controller is a Server Side Pipeline For Async Clinet/Server Requests use AJAX Do Multiple Tasks at once Get data from different stores at the same time Prevent Blocking of the Webserver Worker Threads are not blocked No Thread starvation Async Controllers

  28. Use synchronouse pipelines Operations are simple or short-running Simplicity is important Use asynchronouse pipelines Operations are network-bound or I/O-bound Parallelism is important Provide a mechanism to cancel long-running request Async Controllers

  29. Async Controllers Demo

  30. What about «real life»? Experience from current projects

  31. It’s a Paradigm Shift Can be hard forMS Win-/WebForms Developers Easier for PHP, Java, etc. Developers It’s a lot of Client Side Programming New Know-How is needed Learn ASP.NET MVC

  32. Convention over Configuration Easy to understand New Team Members Maintenance More Unit Tests Better Quality Less Bugfixing Better Reusability Productivity – the good side

  33. No reuse of existing... Concepts Frameworks Controls Loss of Functionality (GUI)Libraries Productivity – the down side

  34. Summary & Resources 3, 2, 1, go

  35. New Web Development Paradigm perfect for... TDD, Large Projects and Teams Many new Features to gain... Productivity and happiness Use ASP.NET MVC When ever you can  Use ASP.NET WebForms Need to use existing Frameworks, Libs or Controls No time to establish needed Know-How Summary

  36. Productivity Tasked based helpers Validation Improvements Ajax Multiple Partial Updates Client Templates Support Architecture Dependency Injection at all levels MEF Controller (Managed Extensibility Framework) Performance Improved Caching More Control over Session ASP.NET MVC 3

  37. Websites http://www.asp.net/mvc http://www.codeplex.com/aspnet Blogs http://www.haacked.com/ http://weblogs.asp.net/scottgu http://www.hanselman.com http://stephenwalther.com/blog Resources

  38. Thank you for your Attention! • For more Information please contact • Jean-Claude Trachsel • Senior Consultant • jean-claude.trachsel@trivadis.com • 076 4000 900 • Trivadis AG • Europastrasse 5 • 8152 Glattbrugg

  39. BesuchenSieunseren Stand Trivadis Innovation Partnership Programm (TIPP) Gemeinsame Innovations-Projekte Trainings Voucher für 1 Schulungstag (Wert CHF 870.-) SharePoint 2010 SQL Server 2008 R(2)efreshed Business Intelligence mit Microsoft in 2010 Talent Scout Herausfordernde, attraktive Jobs warten MeldenSiesich!

More Related