Michele Leroux Bustamante IDesign DTL201 Michele Leroux Bustamante Chief Architect IDesign: ...
-
Upload
rudolf-edwards -
Category
Documents
-
view
223 -
download
4
Transcript of Michele Leroux Bustamante IDesign DTL201 Michele Leroux Bustamante Chief Architect IDesign: ...
A Strategic Comparison of Data Access Technologies from Microsoft
Michele Leroux Bustamante IDesignDTL201
Michele Leroux BustamanteChief Architect IDesign: www.idesign.net
Microsoft Regional Director, MVP Connected Systems
Published Author:ASP.NET Pro (WCF Column), MSDN, CoDeLearning WCF (O’Reilly 2007/2008/2009)
Speaker:Tech Ed, PDC, Dev Connections, other
international events
Blogs:www.dasblonde.net (main)www.thatindigogirl.com (book)
Data Access Technologies
DataSetDataReaderLINQ to SQLEntity FrameworkADO.NET Data Services
Managed Data Provider
IDbConnectionIDbCommand
DataSet
Client
IDataReader
Client
IDbDataAdapter
ADO.NET 1.x Architecture
DataSet
Support data binding, caching, offline work, change tracking, CRUD operationsCode gen with strongly-typed datasets Great for rapid prototypingDatabase support via provider modelConsiderable bloatNot interoperableCumbersome object model
DataSet Scenarios
DALCRUD operations with minimal codeCode gen with strongly-typed set
Service
BusinessComponents
Data Access
SQL
DataSet
Entities
Mapping
Data Contracts / Serializable
Data Access Layer with DataSet
DataSet Scenarios
ASP.NETTwo-way data binding via ObjectDataSourceRequires a data access layer or service proxy
Data Access
SQL
Browser
ASP.NET
ObjectDataSource
DataSet
Service
ASP.NET DataSet Binding
DataSet Scenarios
Windows Forms and WPF applications
Prototype or test with direct access to DBReceive via service tier, offline experience
Service
BusinessComponents
Data Access
SQL
Client
F/S
DataSet
DataSet Binding and Working Offline
demo
DataReader
Rapid, forward-only, read-only cursorUsed for high-performing, customized data access layers, CRUD operationsDatabase support via provider modelMap results to custom typesNo bloat, interoperableNo code gen, third-party tools availableNot used for offline caching
DataReader Scenarios
DALCRUD operations with more verbose codeRely on code genCan more easily respond to dynamically changing database structure
Service
BusinessComponents
DALC
SQL
Entities
Mapping
Reader
Data Contracts / Serializable
Data Access Layer with Reader
DataReader Scenarios
ASP.NETTwo-way data binding via ObjectDataSourceRequires a data access layer or service proxy
Data Access
SQL
Browser
ASP.NET
Reader
ObjectDataSource
Service
ASP.NET Reader Binding
DataReader Scenarios
Windows Forms and WPF applications
Receive data via service tierOffline support must be customized
Service
BusinessComponents
Data Access
SQL
Client
F/S
Custom Types
DataReader Binding and Working Offline
demo
ADO.NET 3.5 Technologies
ADO.NET 3.5.NET Language Integrated Query (LINQ)LINQ features except for LINQ to Entities
ADO.NET 3.5 + SP1Entity Data Model, Entity Framework, Data Services, Object Services, Entity DesignerEntity SQL and LINQ to EntitiesProvider support for SQL 2008 features
LINQ
.NET Language Integrated Query (LINQ)Querying capabilities for many information sources
IEnumerable, IEnumerable<T> or IQueryable<T>Relies on .NET 3.5 language features
LINQ Architecture
Objects
<book> <title/> <author/> <price/></book>
XMLRelational
LINQ enabled data sources
LINQ To Objects
LINQ To XML
LINQ enabled ADO.NET
LINQ To Entities
LINQ To SQL
LINQ To DataSet
.NET Language Integrated Query (LINQ)
LINQ and Relational Data
LINQ to DataSetQuery an ADO.NET DataSet
LINQ to SQLQuery over LINQ to SQL Classes
LINQ to EntitiesQuery over an Entity Data Model
LINQ to SQL
RAD/high-performing data access layers, data binding, CRUD operationsGreat for rapid prototyping, code gen with schema-based entitiesLimited support for mapping between storage and entity modelNo bloat, interoperableNo provider model
LINQ to SQL Scenarios
BLLLINQ queries against DataContext are wrapped in business layer
Service
BusinessComponents
SQL
LINQ DataContext
Data Contracts / Serializable
LINQEntities
Data Access Layer with LINQ to SQL
LINQ to SQL Scenarios
DALLINQ queries against DataContext are wrapped in data access layer
Service
BusinessComponents
SQL
Data Contracts / Serializable
LINQEntities
Data AccessLINQ
DataContext
Data Access Layer with LINQ to SQL
LINQ to SQL Scenarios
MappingMap LINQ to SQL entities to custom business objects in the data access layer
Service
BusinessComponents
Data Access
SQL
CustomMapping
LINQ DataContext
Data Contracts / Serializable
LINQEntities
BusinessEntities
Data Access Layer with LINQ to SQL
demo
LINQ to SQL Scenarios
MappingMap LINQ to SQL entities to custom business objects in the data access layerUse a attributes or external XML to control subtle changes to LINQ to SQL entities
Service
BusinessComponents
SQL
Data Contracts / Serializable
LINQEntities
Data AccessLINQ
DataContext
XmlMap
External XML Mapping
LINQ to SQL Scenarios
ASP.NETTwo-way data binding via LINQDataSource direct to DataContextTwo-way data binding via ObjectDataSource with a DAL or service proxy
LINQ DataContext
SQL
Browser
ASP.NET
LinqDataSource
LINQEntities
LINQ to SQL Classes
ASP.NET LINQ to SQL Binding
demo
LINQ to SQL Scenarios
Windows Forms and WPF applicationsRAD prototyping and testingReceive via service tierCan customize an offline experience
Entity Framework
Enterprise data access looking for features of an Object/Relational (O/R) MapperEF “is” the DALGreat for rapid prototyping, code gen with schema-based entity mapDesigner support to customize mapping between storage and entity modelNo bloat, interoperable
Entity Framework
Rich provider model including:SQL Server, Oracle, SQL Anywhere, DB2, Informix, U2, PostgresSQL, MySQL, SQLite, Virtuoso, FireBird
Query with ESQL or LINQ to EntitiesSupport for change trackingNotifications have limited use today
LINQ to Entities Scenarios
BLLLINQ queries against ObjectContext are wrapped in business layer
DALLINQ queries againstObjectContext are wrapped in data access layer
Service
BusinessComponents
Data Access
SQL
Mapping
EFObjectContext
Data Contracts / Serializable
MappingRules
EFEntities
Data Access Layer with Entity Framework
Entity Framework Scenarios
ASP.NETTwo-way data binding via EntityDataSource or ObjectDataSourceEntityDataSource handles some things that you have to do by hand with EF
Specifically, foreign key resolution EF ObjectContext
SQL
Browser
ASP.NET
EntityDataSource
Mapping
MappingRules
EFEntities
ASP.NET Data Binding
Entity Framework Scenarios
Windows Forms and WPF applicationsRAD prototyping and testingReceive via service for n-tier applications
No offline experience todayChange tracking and notifications particularly useful in 2-tier applications
demo
O/R Mapper SupportFeature LINQ to SQL Entity Framework
Persistence Ignorance/ POCO
Yes, if you convert collections to List<T>
V1 = No, V2 = Yes
Data Mapper Yes, no designer Yes, designer support
Metadata Mapping Yes Yes
Foreign Key Mapping Yes, via EntitySet<T> and EntityRef<T>
V1 = Independent Associations, V2 = Independent or FK Associations
Association Table Mapping No Yes
Lazy Loading Yes, if you don’t convert to List<T>
V1 = Call Load(), V2 = Yes (DeferredLoadingEnabled)
Eager Loading Yes Yes
Identity Map Yes Yes
Unit of Work Yes Yes
Optimistic Concurrency Yes Yes
ADO.NET 4.0
Entity Framework V2Persistence ignorance and POCO Improved lazy loadingBetter n-tier distribution and change trackingEntity Designer customizable templatesImproved unit testing and TDD
LINQ to Entities supersedes LINQ to SQLNot obsolete, useful in simple scenarios
ADO.NET Data Services
RESTful data services based on WCFRelies on HTTP GET, POST, PUT, DELETE verbs to implement APIVery easy to expose any IQueryable data with a fully functional RESTful interfaceUniform pattern for data access regardless of data sourceParticularly useful for exposing data to JavaScript clients
ADO.NET Data Services
Great for rapid prototyping No-code required to expose LINQ to SQL and Entity Framework modelsIntroduces a service tier on data accessImposes a RESTful web service modelInteroperableLimitations on security model today
ADO.NET Data Services Scenarios
The data service IS the data access, business and service layerWindows Forms and WPF Clients
No proxy generationCan create your own wrapperSecurity model is limited (today)
ASP.NET AJAX and Silverlight clients can easily build self-navigating UI for a RESTful modelSecure services with web site model
demo
ADO.NET Data Services
ADO.NET Data Service
SQL Server
LINQ DataContext LINQ
Entities
REST
ADO.NET Data Service
SQL Server (OR other)
EF ObjectContext EF
Entities
REST
Browser Browser
AJAXSilverlightWindows Forms /
WPF Client
Recommendations
Use DataSet for lightweight offline clientsUse DataReader for more dynamic DBsUse LINQ to SQL for RAD, SQL Server only interaction that doesn’t require extensive mapping to business objectsPrefer Entity Framework for most activities that to gain mapping features, platform alternatives, POCO (future), offline caching and change tracking (future)
Recommendations
Use ADO.NET Data Services for: Building Web UI that focuses on access to resources and drilldown accessBuilding RESTful services that are primarily CRUD-basedRAD prototyping of RESTful data to all clients
Be conscious of:Proxy generation limitations (today)Security model limitations (today)
Resources
Learning WCFMichele Leroux Bustamante, O’Reilly 2007Reprinted with updates for VS2008, August 2008
My Blog: http://www.dasblonde.net
See post-conference blog post forsamples from this and other sessions at Tech Ed!
Book blog: www.thatindigogirl.com
question & answer
www.microsoft.com/teched
Sessions On-Demand & Community
http://microsoft.com/technet
Resources for IT Professionals
http://microsoft.com/msdn
Resources for Developers
www.microsoft.com/learningMicrosoft Certification and Training Resources
www.microsoft.com/learning
Microsoft Certification & Training Resources
Resources
DTL Track Resources
Visit the DPR TLC for a chance to win a copy of Visual Studio Team Suite. Daily drawing occurs every day in the TLC at 4:15pm. Stop by for a raffle ticket
http://www.microsoft.com/visualstudio
http://www.microsoft.com/visualstudio/en-us/products/teamsystem/default.mspx
Please visit us in the TLC blue area
Complete an evaluation on CommNet and enter to win!
© 2009 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.