Upload
anakin
View
45
Download
1
Embed Size (px)
DESCRIPTION
ADO.NET vNext The Entity Data Model, Object Services, and LINQ. Bob Beauchemin Director of Developer Resources, SQLskills http://www.SQLskills.com/blogs/bobb. About Bob Beauchemin. Independent Consultant/Trainer/Writer/Speaker Director of Developer Resources, SQLskills - PowerPoint PPT Presentation
Citation preview
Satisfy Your Technical Curiosity
ADO.NET vNextThe Entity Data Model,
Object Services, and LINQ
Bob BeaucheminDirector of Developer Resources, SQLskills
http://www.SQLskills.com/blogs/bobb
Satisfy Your Technical Curiosity
About Bob BeaucheminIndependent Consultant/Trainer/Writer/SpeakerDirector of Developer Resources, SQLskills
Website: http://www.SQLskills.comBlog: http://www.SQLskills.com/blogs/bobb
SQL Server MVP
Author of books and numerous resources
related to SQL Server and data access
A Developer's Guide to SQL Server 2005
A First Look at SQL Server 2005 for Developers “Best Book” SQL Server Magazine’s Reader’s Choice Awards (2005)
Essential ADO.NET
Satisfy Your Technical Curiosity
Overview
What IS in vNext?The Entity Data ModelEntity ProviderEntity SQLObject ServicesLINQ for EntitiesLINQ for SQLLINQ for DataSet
Satisfy Your Technical Curiosity
What is ADO.NET vNext?
A part of Visual Studio Orcas releaseIn .NET Framework 3.5Changes to languages
VB 9.0C# 3.0
CTP available now
Satisfy Your Technical Curiosity
What IS in ADO.NET vNext?
A new data modelEntity Data ModelThree XML Schemas for defining and mapping
CSDL - conceptual data language (DDL for EDM)SSDL - store-specific data languageMSL - mapping data language
A set of Object ServicesAn ADO.NET data provider (EntityProvider)Hooks for provider writers
EDM not restricted to SQL Server
Satisfy Your Technical Curiosity
What IS in Orcas?
Two new data access languagesLINQEntity SQL (ESQL)
Implementations for databasesLINQ to SQLLINQ to Entities
...and the ADO.NET DataSetLINQ to DataSet
Satisfy Your Technical Curiosity
Entity Data Model
Applications model in terms of entitiesEDM is a conceptual model that includes
Structural inheritanceCompositionRelationships as first class types
EDM is not a 1-1 match of the relational model
Entities != RowsCollections != Tables
Satisfy Your Technical Curiosity
Views of DataViews of data are layered
Lowest level - physical storageFilegroupsExact layout of rows on diskIndex structureRelational apps unaware of this level
Logical levelTables, Keys, Column ConstraintsPK/FK constructs, "Join tables"Relational modeling works at this level
Conceptual levelEntities and relationshipsEDM modeling works at this level
Satisfy Your Technical Curiosity
Uses of the Conceptual Level
Existing tools work at conceptual levelReport Builder - SMDL filesReplication - Transactional replication groupsUDM - Data Source Views in Analysis Services
Each tool uses a slightly different modelEDM could be used to consolidate models
Satisfy Your Technical Curiosity
Entity Data Model
Borrows from Relational and E-R modelsBorrows from UML and object modelsConcepts
Entity Types and Entity SetsAssociations and Association SetsComplex typesStructural InheritanceCollections
Entity SQL to query against EDM sets
Satisfy Your Technical Curiosity
EDM Description LanguageEDM is a model
Not a physical implementationEDM is described in CSDL
Conceptual Schema Definition LanguageAn XML-based grammarDefines model in terms of
Complex types made up of simple typesInheritanceRelationships
EDM model is mapped to RDBMSSSDL - Describes relational databaseMDL - Maps
Satisfy Your Technical Curiosity
Entity SQL LanguageEntity SQL - query language for EDM
Basic relational query concepts +SQL 1999 query concepts +Retrieval as tuples or typesPolymorphic queriesSupport for relationships
Entity SQL is a textual query languageQuery text not programming language specificNo compile-time checking or IntelliSenceCurrently query-only
Update through Object ServicesUpdate through ESQL in future
Satisfy Your Technical Curiosity
Object ServicesObject Services provides services for EDM
Fetch semanticsLazy loading option
Change trackingIdentity managementUpdatabilityTransaction support
Object Services uses ESQL to queryUpdates through change tracking layerStored procedures and functions supported
Object Services built over ADO.NET provider
Satisfy Your Technical Curiosity
EntityProvider
ADO.NET provider for EDM"Native store" is EDM"Native language" is ESQL
Provider support useful forIntegration with existing toolsFamiliarity for ADO.NET programmers
Satisfy Your Technical Curiosity
Wither LINQ?
LINQ is language integrated queryStrong typingIntelliSenseAnonymous types that represent projections
LINQ enables query overObject collectionsXML (LINQ to XML)Relational Databases (LINQ to SQL)ADO.NET DataSet (LINQ to DataSet)EDM (LINQ to Entities)
Satisfy Your Technical Curiosity
LINQ and ESQLWhy are there two query languages?
LINQ is programming language basedmultiple types of data as inputcan be extended to new input typesuses LINQ to SQL for database programming
ESQL is data model basedEDM-specific an extension to the SQL languageupdate DML is plannedintegration with DB-centric tools plannedcan use Object Services for database programming
Or ...You can use LINQ to Entities for database programming
Satisfy Your Technical Curiosity
LINQ to SQL and EDMLINQ to SQL allows
Object model based on relational modelOne class per tableRelationships (1-1, 1-many, many-many)Inheritance not related to persistenceStored procedures or LINQ Services for inserts, updates, and deletes
EDM mapping allowsEntity model independent of relational modelStructural inheritance and compositionRelationships as first-class typesStored procedures on Object Services for inserts, updates, and deletes
Neither currently supports SQLCLR UDTs
Satisfy Your Technical Curiosity
Object Services
EDM is the only "data store"ESQL is the only programming language ADO.NET provider writers can include support for EDM in providers
Satisfy Your Technical Curiosity
LINQ Services
LINQ Services useable withLINQ to EntitiesLINQ to SQLLINQ to DataSetXML data
Model is similar for all typesIQueryable<T>
Operations can be expanded with user-defined constructs in code
Satisfy Your Technical Curiosity
LINQ Tool Support
In Visual Studio Orcas Mar CTPAdd LINQ to SQL file (dbml)
Can drag tables from Server ExplorerCan drag class definitions from Solution ExplorerCan add properties, associations, inheritance to the modelCan configure insert/update/delete proceduresGenerates classes in project
LINQ - database table DDL generation from dbmlNo relationships or constraints in generated DDL
SQLMetal command line tool for LINQ
Satisfy Your Technical Curiosity
EDM Tool Support
In Visual Studio Orcas Mar CTPAdd ADO.NET Entity Model
Can add tables from the databaseGenerates CSDL, SSDL, MSLGenerates classes in projectCan customize using schema-guided XML editor
EDMGen command line tool for EDM
Satisfy Your Technical Curiosity
SummaryADO.NET vNext added support for EDM
ADO.NET providerObject ServicesESQL and LINQ for Entities
ADO.NET includes layered approachRich object modelCoexistence with familiar ADO.NET model
with extensions for entitiesObject Services for insert/update/delete, transactions
LINQ for SQL includes straightforward relational mappingTight integration with programming languages
LINQ for DataSets allows queries over DataSet
Satisfy Your Technical Curiosity
Satisfy Your Technical Curiosity
ResourcesThe LINQ project
http://msdn2.microsoft.com/en-us/netframework/aa904594.aspxADO.NET - Making the Conceptual Level Real
http://msdn2.microsoft.com/en-us/library/aa730866(VS.80).aspxVisual Studio Orcas Forums
http://forums.microsoft.com/MSDN/default.aspx?ForumGroupID=153&SiteID=1ADO.NET Team Blog
http://blogs.msdn.com/adonet Data Blog
http://blogs.msdn.com/data Dinesh's Cyberstation
http://blogs.msdn.com/dinesh.kulkarni mikechampion's weblog
http://blogs.msdn.com/mikechampion Oakleaf Systems
http://oakleafblog.blogspot.com Panopticon Central
http://www.panopticoncentral.netPaul Gielens Thoughts Service
http://weblogs.asp.net/pgielens System.Data.Objects dev guy
http://blogs.msdn.com/dsimmons Tim Mallalieu's Blog
http://blogs.msdn.com/timmall Bob Beauchemin's Blog
http://www.SQLskills.com/blogs/bob
Satisfy Your Technical Curiosity
Satisfy Your Technical Curiosity
ADO.NET vNextThe Entity Data Model,
Object Services, and LINQBob Beauchemin
Director of Developer Resources, SQLskillshttp://www.SQLskills.com/blogs/bobb
Satisfy Your Technical Curiosity