Download presentation
Presentation is loading. Please wait.
Published byRudolf Edwards Modified over 9 years ago
2
Michele Leroux Bustamante IDesign DTL201
3
Michele Leroux Bustamante Chief Architect IDesign: www.idesign.netwww.idesign.net Microsoft Regional Director, MVP Connected Systems Published Author: ASP.NET Pro (WCF Column), MSDN, CoDe Learning WCF (O’Reilly 2007/2008/2009) Speaker: Tech Ed, PDC, Dev Connections, other international events Blogs: www.dasblonde.net (main) www.thatindigogirl.com (book) www.dasblonde.net www.thatindigogirl.com
4
Data Access Technologies DataSet DataReader LINQ to SQL Entity Framework ADO.NET Data Services
5
Managed Data Provider IDbConnection IDbCommand DataSet Client IDataReader Client IDbDataAdapter ADO.NET 1.x Architecture
6
DataSet Support data binding, caching, offline work, change tracking, CRUD operations Code gen with strongly-typed datasets Great for rapid prototyping Database support via provider model Considerable bloat Not interoperable Cumbersome object model
7
DataSet Scenarios DAL CRUD operations with minimal code Code gen with strongly-typed set Service Business Components Business Components Data Access SQL DataSet Entities Mapping Data Contracts / Serializable Data Access Layer with DataSet
8
DataSet Scenarios ASP.NET Two-way data binding via ObjectDataSource Requires a data access layer or service proxy Data Access SQL Browser ASP.NET ObjectDataSource DataSet Service ASP.NET DataSet Binding
9
DataSet Scenarios Windows Forms and WPF applications Prototype or test with direct access to DB Receive via service tier, offline experience Service Business Components Business Components Data Access SQL Client F/S DataSet DataSet Binding and Working Offline
11
DataReader Rapid, forward-only, read-only cursor Used for high-performing, customized data access layers, CRUD operations Database support via provider model Map results to custom types No bloat, interoperable No code gen, third-party tools available Not used for offline caching
12
DataReader Scenarios DAL CRUD operations with more verbose code Rely on code gen Can more easily respond to dynamically changing database structure Service Business Components Business Components DALC SQL Entities Mapping Reader Data Contracts / Serializable Data Access Layer with Reader
13
DataReader Scenarios ASP.NET Two-way data binding via ObjectDataSource Requires a data access layer or service proxy Data Access SQL Browser ASP.NET Reader ObjectDataSource Service ASP.NET Reader Binding
14
DataReader Scenarios Windows Forms and WPF applications Receive data via service tier Offline support must be customized Service Business Components Business Components Data Access SQL Client F/S Custom Types Custom Types DataReader Binding and Working Offline
16
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 + SP1 Entity Data Model, Entity Framework, Data Services, Object Services, Entity Designer Entity SQL and LINQ to Entities Provider support for SQL 2008 features
17
LINQ.NET Language Integrated Query (LINQ) Querying capabilities for many information sources IEnumerable, IEnumerable or IQueryable Relies on.NET 3.5 language features
18
LINQ Architecture Objects XMLRelational LINQ enabled data sources LINQ To Objects LINQ To Objects LINQ To XML LINQ To XML LINQ enabled ADO.NET LINQ To Entities LINQ To Entities LINQ To SQL LINQ To SQL LINQ To DataSet LINQ To DataSet.NET Language Integrated Query (LINQ)
19
LINQ and Relational Data LINQ to DataSet Query an ADO.NET DataSet LINQ to SQL Query over LINQ to SQL Classes LINQ to Entities Query over an Entity Data Model
20
LINQ to SQL RAD/high-performing data access layers, data binding, CRUD operations Great for rapid prototyping, code gen with schema-based entities Limited support for mapping between storage and entity model No bloat, interoperable No provider model
21
LINQ to SQL Scenarios BLL LINQ queries against DataContext are wrapped in business layer Service Business Components Business Components SQL LINQ DataContext LINQ DataContext Data Contracts / Serializable LINQ Entities LINQ Entities Data Access Layer with LINQ to SQL
22
LINQ to SQL Scenarios DAL LINQ queries against DataContext are wrapped in data access layer Service Business Components Business Components SQL Data Contracts / Serializable LINQ Entities LINQ Entities Data Access LINQ DataContext LINQ DataContext Data Access Layer with LINQ to SQL
23
LINQ to SQL Scenarios Mapping Map LINQ to SQL entities to custom business objects in the data access layer Service Business Components Business Components Data Access SQL Custom Mapping LINQ DataContext LINQ DataContext Data Contracts / Serializable LINQ Entities LINQ Entities Business Entities Business Entities Data Access Layer with LINQ to SQL
25
LINQ to SQL Scenarios Mapping Map LINQ to SQL entities to custom business objects in the data access layer Use a attributes or external XML to control subtle changes to LINQ to SQL entities Service Business Components Business Components SQL Data Contracts / Serializable LINQ Entities LINQ Entities Data Access LINQ DataContext LINQ DataContext Xml Map Xml Map External XML Mapping
26
LINQ to SQL Scenarios ASP.NET Two-way data binding via LINQDataSource direct to DataContext Two-way data binding via ObjectDataSource with a DAL or service proxy LINQ DataContext SQL Browser ASP.NET LinqDataSource LINQ Entities LINQ Entities LINQ to SQL Classes ASP.NET LINQ to SQL Binding
28
LINQ to SQL Scenarios Windows Forms and WPF applications RAD prototyping and testing Receive via service tier Can customize an offline experience
29
Entity Framework Enterprise data access looking for features of an Object/Relational (O/R) Mapper EF “is” the DAL Great for rapid prototyping, code gen with schema-based entity map Designer support to customize mapping between storage and entity model No bloat, interoperable
30
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 Entities Support for change tracking Notifications have limited use today
31
LINQ to Entities Scenarios BLL LINQ queries against ObjectContext are wrapped in business layer DAL LINQ queries against ObjectContext are wrapped in data access layer Service Business Components Business Components Data Access SQL Mapping EF ObjectContext EF ObjectContext Data Contracts / Serializable Mapping Rules Mapping Rules EF Entities EF Entities Data Access Layer with Entity Framework
32
Entity Framework Scenarios ASP.NET Two-way data binding via EntityDataSource or ObjectDataSource EntityDataSource handles some things that you have to do by hand with EF Specifically, foreign key resolution EF ObjectContext SQL Browser ASP.NET EntityDataSource Mapping Rules Mapping Rules EF Entities EF Entities ASP.NET Data Binding
33
Entity Framework Scenarios Windows Forms and WPF applications RAD prototyping and testing Receive via service for n-tier applications No offline experience today Change tracking and notifications particularly useful in 2-tier applications
35
O/R Mapper Support FeatureLINQ to SQLEntity Framework Persistence Ignorance / POCO Yes, if you convert collections to List V1 = No, V2 = Yes Data MapperYes, no designerYes, designer support Metadata MappingYes Foreign Key MappingYes, via EntitySet and EntityRef V1 = Independent Associations, V2 = Independent or FK Associations Association Table MappingNoYes Lazy LoadingYes, if you don’t convert to List V1 = Call Load(), V2 = Yes (DeferredLoadingEnabled) Eager LoadingYes Identity MapYes Unit of WorkYes Optimistic ConcurrencyYes
36
ADO.NET 4.0 Entity Framework V2 Persistence ignorance and POCO Improved lazy loading Better n-tier distribution and change tracking Entity Designer customizable templates Improved unit testing and TDD LINQ to Entities supersedes LINQ to SQL Not obsolete, useful in simple scenarios
37
ADO.NET Data Services RESTful data services based on WCF Relies on HTTP GET, POST, PUT, DELETE verbs to implement API Very easy to expose any IQueryable data with a fully functional RESTful interface Uniform pattern for data access regardless of data source Particularly useful for exposing data to JavaScript clients
38
ADO.NET Data Services Great for rapid prototyping No-code required to expose LINQ to SQL and Entity Framework models Introduces a service tier on data access Imposes a RESTful web service model Interoperable Limitations on security model today
39
ADO.NET Data Services Scenarios The data service IS the data access, business and service layer Windows Forms and WPF Clients No proxy generation Can create your own wrapper Security model is limited (today) ASP.NET AJAX and Silverlight clients can easily build self- navigating UI for a RESTful model Secure services with web site model
41
ADO.NET Data Services ADO.NET Data Service ADO.NET Data Service SQL Server LINQ DataContext LINQ DataContext LINQ Entities LINQ Entities REST ADO.NET Data Service ADO.NET Data Service SQL Server (OR other) SQL Server (OR other) EF ObjectContext EF ObjectContext EF Entities EF Entities REST Browser AJAX Silverlight Windows Forms / WPF Client Windows Forms / WPF Client
42
Recommendations Use DataSet for lightweight offline clients Use DataReader for more dynamic DBs Use LINQ to SQL for RAD, SQL Server only interaction that doesn’t require extensive mapping to business objects Prefer Entity Framework for most activities that to gain mapping features, platform alternatives, POCO (future), offline caching and change tracking (future)
43
Recommendations Use ADO.NET Data Services for: Building Web UI that focuses on access to resources and drilldown access Building RESTful services that are primarily CRUD-based RAD prototyping of RESTful data to all clients Be conscious of: Proxy generation limitations (today) Security model limitations (today)
44
Resources Learning WCF Michele Leroux Bustamante, O’Reilly 2007 Reprinted with updates for VS2008, August 2008 My Blog: http://www.dasblonde.net http://www.dasblonde.net See post-conference blog post for samples from this and other sessions at Tech Ed! Book blog: www.thatindigogirl.com www.thatindigogirl.com
46
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/learning Microsoft Certification and Training Resources www.microsoft.com/learning Microsoft Certification & Training Resources Resources
47
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
48
Complete an evaluation on CommNet and enter to win!
49
© 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.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.