of 40 /40
Jean-Claude Trachsel Senior Consultant, Trivadis AG [email protected] ASP.NET MVC 2 The good news

Embed Size (px)


ASP.NET MVC 2. The good news. Jean-Claude Trachsel Senior Consultant, Trivadis AG j [email protected] Agenda. What is ASP.NET MVC Features of Version 2 What about the «real life»? Summary. What is ASP.NET MVC. A short introduction. - PowerPoint PPT Presentation

Transcript of ASP.NET MVC 2

Presentation Title

Jean-Claude TrachselSenior Consultant, Trivadis [email protected] MVC 2The good newsAgendaWhat is ASP.NET MVCFeatures of Version 2What about the real life?Summary

What is ASP.NET MVCA short introductionFramework based on Model-View-Controller PatternSeparation of ConcernsFramework is focusing on...Pure Web DevelopmentStateless, no ViewStateFull control over markupTestabilityTDD, Unit TestsMaintainabilityExtensibility and Flexibility Modern aspects like AOP, DI, IoCWhat is ASP.NET MVCPositioning ASP.NET MVCASP.NET Web FormsASP.NET MVCASP.NET Framework.NET FrameworkVisual Studio TemplateController and ViewUnit TestDemoFeatures of Version 2Areas, Validation, Typed UI Helpers, etc.Goals of the DevTeam for Version 2More ProductivityMore SecurityMore PerformanceMore ExtensibilityMore Happiness What do we get?What we will look atAreasValidationTyped UI HelpersUI Helper TemplatesAsync Controllers

AreasSingle Project and Multi Project AreasEnterprise ready with AreasStructure your Solution with...Single Project AreaMulti Project AreaEasy re-use of CodeAreas what for?

Single Project AreaFolder StructurRoute ClassInherits from AreaRegistrationDefines the route to the ControllerGlobal.asaxRegister the area routesAreas whats needed?

Single Project AreasDemoValidationData Annotations AttributesData Validation with DataAnnotations AttributesIntroduced with .NET 3.5 SP 1Benefits of DataAnnotations AttributesSet in one central place, on the modelUsed by different TechnologiesUsed in ASP.NET Dynamic DataUsed in WCF RIA ServicesASP.NET MVC ValidationUse of DataAnnotationsSet Attributes on the Model

[MetadataType(typeof(ProductMetadata))]public partial class Product{}

public class ProductMetadata{ [Required] public string Name { get; set; } }

Attributes that are availableRequiredRangeRegularExpressionStringLengthCustomValidationBuild your own

DataAnnotationsServer Site ValidationModelBinder ClassClient Site ValidationjQuery Validation LibraryValidation in ASP.NET MVCValidation with DataAnnotation AttributesServer- and Client SiteDemoTyped UI Helpers...and the UI Helper TemplatesHtmlHelper ExtensionsASP.NET MVC 1

ASP.NET MVC 2Typed UI Helpers

p.ProductID)%> p.ProductID)%>Benefits are...IntellisenseCompile Time SupportType based renderingSupport for standard and complex typesTyped UI HelpersExtend the Typed UI Helper MethodsDefine the Rendering via UserControlsSupports standard and complex typesUsed by...Name ConventionUI Helper Method ParameterViewModel AttributesUI Helper TemplatesTyped UI HelpersUI Helper Template for DateTimeDemoAsync ControllersBe smart, be fastUse of Async Controllerpublic class HomeController : AsyncController{ public void NAMEAsync() { AsyncManager.OutstandingOperations.Increment(3); // Do all Tasks asynchronouse }

public ActionResult NAMECompleted(object params) { // Do final work return View("NAME"); }}

Async Controller is a Server Side PipelineFor Async Clinet/Server Requests use AJAXDo Multiple Tasks at onceGet data from different stores at the same timePrevent Blocking of the WebserverWorker Threads are not blockedNo Thread starvation

Async ControllersUse synchronouse pipelinesOperations are simple or short-runningSimplicity is importantUse asynchronouse pipelinesOperations are network-bound or I/O-boundParallelism is importantProvide a mechanism to cancel long-running request

Async ControllersAsync ControllersDemoWhat about real life?Experience from current projectsIts a Paradigm Shift Can be hard for MS Win-/WebForms DevelopersEasier for PHP, Java, etc. DevelopersIts a lot of Client Side ProgrammingNew Know-How is needed

Learn ASP.NET MVCConvention over ConfigurationEasy to understandNew Team MembersMaintenanceMore Unit TestsBetter QualityLess BugfixingBetter Reusability

Productivity the good sideNo reuse of existing...ConceptsFrameworksControlsLoss of Functionality (GUI)Libraries

Productivity the down sideSummary & Resources3, 2, 1, goNew Web Development Paradigm perfect for...TDD, Large Projects and TeamsMany new Features to gain...Productivity and happinessUse ASP.NET MVCWhen ever you can Use ASP.NET WebFormsNeed to use existing Frameworks, Libs or ControlsNo time to establish needed Know-How

SummaryProductivity Tasked based helpersValidation Improvements Ajax Multiple Partial UpdatesClient Templates SupportArchitectureDependency Injection at all levels MEF Controller (Managed Extensibility Framework)Performance Improved Caching More Control over SessionASP.NET MVC 3Websites

ResourcesThank you for your Attention!For more Information please contact

Jean-Claude TrachselSenior Consultant

[email protected] 4000 900

Trivadis AGEuropastrasse 58152 Glattbrugg

SharePoint 2010SQL Server 2008 R(2)efreshedBusiness Intelligence mit Microsoft in 2010Trainings Voucher fr 1 Schulungstag (Wert CHF 870.-)

Talent ScoutHerausfordernde, attraktive Jobs warten Melden Sie sich!

Besuchen Sie unseren Stand

Trivadis Innovation Partnership Programm (TIPP)Gemeinsame Innovations-Projekte