scott hunter program manager microsoft corporation pc30

24
ASP.NET Dynamic Data Scott Hunter Program Manager Microsoft Corporation PC30

Upload: brianne-daniels

Post on 01-Jan-2016

222 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Scott Hunter Program Manager Microsoft Corporation PC30

ASP.NET Dynamic Data

Scott HunterProgram ManagerMicrosoft Corporation

PC30

Page 2: Scott Hunter Program Manager Microsoft Corporation PC30

Session Objective(s) Understand the ASP.NET data strategy Understand the ASP.NET Dynamic Data feature

Key Takeaways Support for WebForms continues Support for MVC coming Model driven development across

multiple presentation layers

Session Objectives And Takeaways

Page 3: Scott Hunter Program Manager Microsoft Corporation PC30

An easy powerful way to build a data-driven websites Allows you to get started quickly using scaffolding UI can be completely customized

through templates and pages Validation and business rules specified

on data model flow through to UI Allows flexible URL routing, based on data schema and

separate from the physical page structure of the site New dynamic controls make scenarios like sorting, paging,

editing and filtering remarkably easy to implement Available now in .NET Framework 3.5 SP1!

What Is Dynamic Data?

Page 4: Scott Hunter Program Manager Microsoft Corporation PC30

Dynamic Data At A Glance

demo

Page 5: Scott Hunter Program Manager Microsoft Corporation PC30

Scaffolding

// Global.asax: Application_Startmodel.RegisterContext (typeof(NorthwindDataContext), new ContextConfiguration() { ScaffoldAllTables = true });

// WARNING: This enables scaffolding for every table in the model. To enable scaffolding on a per-table or per-column basis, you can use attributes on the model:

[MetadataType(typeof(ProductMeta))] public partial class ProductMeta[ScaffoldTable(true)] {public partial class Product [ScaffoldColumn(true)]{ public object UnitPrice { get; set; }

… }}

Page 6: Scott Hunter Program Manager Microsoft Corporation PC30

Routing

// Global.asax: Application_Start

RouteTable.Routes.routes.Add (new DynamicDataRoute("{table}/{action}.aspx") { Constraints = new RouteValueDictionary(new { action = "List|Details|Edit|Insert" }), Model = model});

RouteTable.Routes.routes.Add (new DynamicDataRoute("{table}/List.aspx") { Action = PageAction.List, ViewName = "List", Model = model});

RouteTable.Routes.Add(new DynamicDataRoute("MyCategoryDetail/{CategoryID}") { Model = model, Table = "Categories", Action = "Details" });

Page 7: Scott Hunter Program Manager Microsoft Corporation PC30

Scaffolding And Routing

demo

Page 8: Scott Hunter Program Manager Microsoft Corporation PC30

Dynamic Data provides UI customization at many levels (from least to most control)

UI Customization

PageTemplates

FieldTemplates

UIHint/DataType on Model

CustomPages

UIHints on DynamicField/DynamicControl

Page 9: Scott Hunter Program Manager Microsoft Corporation PC30

Allow customization of columns using template based controls Based on the type of the column Source code for standard templates is provided Can be overriden with DataType and

UIHint attributes or properties Easy to create

Implement method to set and get values

Field Template Controls

Page 10: Scott Hunter Program Manager Microsoft Corporation PC30

DynamicDataManager GridView, DetailsView

DynamicDataField ListView, FormView

DynamicControl LinqDataSource, EntitiesDataSource

DynamicControlParameter DynamicQueryStringParameter

DynamicValidator DynamicFilter (UserControl), FilterRepeater

Dynamic Data Controls

Page 11: Scott Hunter Program Manager Microsoft Corporation PC30

UI Customization Demo

demo

Page 12: Scott Hunter Program Manager Microsoft Corporation PC30

Scenario: Reduce code in existing pages Validation

Move validation to data model instead of in individual pages. Change in one place affects entire site

Field Templates Add custom controls in one place

instead of in each of your pages Enable custom controls on model

Use In Existing Pages

Page 13: Scott Hunter Program Manager Microsoft Corporation PC30

Use In Existing Pages

demo

Page 14: Scott Hunter Program Manager Microsoft Corporation PC30

Support for more data access layers ADO.NET Data Services (formerly Astoria) Custom Business Logic Layer

Field Templates URL, E-mail, and Enumeration

Entity Templates Automatic templates for ListView, FormView Templates based on Entity instead of Field

Inheritance Support (EF and Linq2SQL) QueryBlock

Rich Declarative Linq Expressions Rich Filtering

Attributes Templates

MVC Support

Dynamic Data Futures

Page 15: Scott Hunter Program Manager Microsoft Corporation PC30

BusinessLogicLayerDataSource ObjectDataSource that returns IQueryable Support new DataProviderModel

Entity Framework Linq to SQL Custom

Query Block BusinessLogicDataSource/LinqDataSource/

EntityDataSource Declarative Linq Expressions And and Or Range and Contains Custom

Business Logic And Declarative Linq Queries

Page 16: Scott Hunter Program Manager Microsoft Corporation PC30

Business Logic Layer And Query Block

demo

Page 17: Scott Hunter Program Manager Microsoft Corporation PC30

Make building data-driven Web apps easy Ruby on Rails

Dynamic Data and MVCScaffolding, templates and data validation

Support for abstract data-layerRemoves need for specific DL (SQL, entities ..) Allows scaffolding of objects

Keeps MVC conceptsUses HTML helpersTestable

MVC

Page 18: Scott Hunter Program Manager Microsoft Corporation PC30

MVC

demo

Page 19: Scott Hunter Program Manager Microsoft Corporation PC30

Breakout Sessions/Chalk Talks PC21 – ASP.NET MVC PC30 – ASP.NET Dynamic Data PC31 – ASP.NET and Jquery PC32 – ASP.NET Ajax Futures PC33 – Microsoft Visual Studio: Easing ASP.NET Web PC41 – ASP.NET Cache Extensibility TL07 – Developing Applications Using Data Services TL14 – Introducing Velocity TL20 – Entity Framework Futures TL48 – Microsoft Visual Studio: Web Development Futures TL56 – Velocity Internals ES15 – Deploying Web Applications with Microsoft Internet

Information Services 7.0 and the Web Deployment Tool

Related Content

Page 20: Scott Hunter Program Manager Microsoft Corporation PC30

http://www.asp.net/dynamicdata http://www.codeplex.com/aspnet

http://blogs.msdn.com/davidebb/ http://blogs.msdn.com/marcinon/ http://blogs.msdn.com/scothu/ http://weblogs.asp.net/scottgu http://www.hanselman.com/blog/

Resources

Page 21: Scott Hunter Program Manager Microsoft Corporation PC30

Evals & Recordings

Please fill

out your

evaluation for

this session at:

This session will be available as a recording at:

www.microsoftpdc.com

Page 22: Scott Hunter Program Manager Microsoft Corporation PC30

Please use the microphones provided

Q&A

Page 23: Scott Hunter Program Manager Microsoft Corporation PC30

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

Page 24: Scott Hunter Program Manager Microsoft Corporation PC30