Data Access Methodologies When to choose what ADO
















- Slides: 16
Data Access Methodologies: When to choose what (ADO. NET, Entity Framework, WCF Data Services) Wriju Ghosh Lead Partner Consultant, Microsoft
Agenda • Data Access Technology Recap • ADO. NET Entity Framework • WCF Data Services / OData
Development of Native Data Access ADO Simplified Object Level (Record. Set) (pointerless languages) Object Level OLE DB (pointer-capable languages) RDO MSDASQL ODBC API Various Stores API … Various Stores Abstract Call-Level Native Client DB-Library P H P JDBC ESQLDrivers for C SQL Server Databases Direct APIs Raw Data
WCF Data Services . NET Data Access (OData) Entity Framework Entity Data Model LINQ to SQL, Data. Set ADO. NET Core LINQ to XML LINQ to Objects, etc. Object-Relational Mapping LINQ to Entities LINQ Various Stores + XML … OLE DB ODBC Various Stores Language Integration . NET Classes Data Providers ADO. NET Data Providers IQueryable IEnumerable Any Data RESTful Services Sql. Client SQL Server Databases Raw Data
. NET Data Access Guidance • ADO. NET Core – Use it when you want the lowest level control • LINQ to SQL – Fully supported but little new investment • ADO. NET Entity Framework – Significant investment in. NET 4 and beyond – All new apps should start here – Existing apps can leverage EF incrementally • WCF Data Services and OData – Use it for services that primarily expose data – Growing ecosystem of clients and servers
Entity Framework in Context • ORM from Microsoft and continued future investments • Fully supports WCF • Next generation of Data Access • First class POCO support • Native support for Stored Procedures • Support for Oracle, My. SQL, DB 2, Fire. Bird and many more
New in Entity Framework 4. 0 • • • Model-first development Automatic pluralization Foreign keys in models POCO class support Lazy loading T 4 Code Generation Template customization IObject. Set Virtual Save. Changes Object. State. Manager control • • • Self-tracking entities SQL generation improvements More LINQ operator support LINQ extensibility Execute. Store. Query Execute. Store. Command SPROC import improvements Model defined functions WPF designer integration Code-Only development (Feature CTP)
EF Recommendations • Start with the EF for new apps • Use Patterns – adopting an O/RM sets you up well for this – Repository, Unit of Work – POCO / “Persistence Ignorant” classes – DDD/TDD • Learn about the EF features and techniques you can use to tune your applications – Compiled queries – Splitting up models – …
Data Services Guidance
Data Services in Context • What is WCF Data Services? – Server framework for creating REST-based data-centric web services – Client libraries for consuming data services – REST-based protocol called OData (Open Data Protocol) • It’s part of the WCF stack • The OData ecosystem is growing! – Big announcement at MIX 10
Scenarios for Data Services Data in Modern Web Apps Online Services DLL + XAML Data (XML, etc) • Client-server designed and deployed together • Loosely coupled clients and servers • Functionality surfaces in user interface • State, functionality through service interface
What is OData? • Uniform way of representing structured data – Atom, JSON formats • Uniform URL conventions – Navigation, filtering, sorting, paging, etc. • Uniform operations – Addressability – GET, POST, PUT, DELETE always mean the same • A growing number of services and clients – Servers: OGDI, Net. Flix, Reporting Services – Clients: . NET, AJAX, PHP, Excel
Social connections • http: //blogs. msdn. com/b/wriju • Facebook (Wriju Ghosh) • Twitter (wriju_ghosh) • Email (wriju. ghosh@microsoft. com)
Resources Software Application Developers Infrastructure Professionals http: //msdn. microsoft. com/ http: //technet. microsoft. com/ msdnindia @msdnindia technetindia @technetindia
© 2011 Microsoft Corporation. All rights reserved. Microsoft, 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.