introducing entity framework
DESCRIPTION
this is an introduction session about Microsoft Entity Framework 4.0TRANSCRIPT
![Page 1: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/1.jpg)
Introducing Entity Framework
EF v1.0
![Page 2: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/2.jpg)
History of ADO.Net
Object Relational Mapping {ORM}
What is Entity Framework?
Entity Framework Architecture
Entity Data Model {EDM}
Entity Client & Object Services
LINQ to Entities & Entity SQL {eSQL}
Agenda
![Page 3: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/3.jpg)
Load Related Objects
Inheritance in Entity Framework
Entity Framework providers and multiple database support
Entity Framework Limitations
External Tools
References
Agenda (Cont.)
![Page 4: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/4.jpg)
History of ADO .Net
![Page 5: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/5.jpg)
•Object Oriented Datasets.
•Disconnected Model.
•Provider Abstraction.
2002ADO .Net v1.0
•Provider Factories•Metadata schema•Asynchronous Command Execution
•Conflict Detection•Batch Updates•Multiple Active Result Sets (MARS)
2005ADO .Net v2.0
![Page 6: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/6.jpg)
•Nothing changed in ADO.net
2006ADO .Net v3.0
•Paging Support
•Synchronization APIs
•Language integrated Query (LINQ)
•LINQ to SQL
2007ADO .Net v3.5
![Page 7: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/7.jpg)
•Entity Data Model (EDM)•Object Services•LINQ to Entities•Entity SQL•Entity Client•ADO .Net Data Services
2008ADO .Net v3.5
SP1
![Page 8: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/8.jpg)
Object Relational Mapping
{ORM}
![Page 9: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/9.jpg)
Definition
ORM & Visual Studio
External Tools & frameworks for .Net
ORM Basics & Concepts
![Page 10: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/10.jpg)
What is Entity Framework?
Why it is considered an ORM?
![Page 11: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/11.jpg)
What is Entity Framework?
An ORM framework, Why?
Database Independent
Extensible
Part of Microsoft .Net framework 3.5 SP1
![Page 12: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/12.jpg)
Getting Started
Demo
![Page 13: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/13.jpg)
Entity Framework Architecture
![Page 14: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/14.jpg)
Entity Framework Architecture
![Page 15: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/15.jpg)
Entity Data Model (EDM)
What is Entity Data Mode?
![Page 16: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/16.jpg)
SSDL
MSL
CSDL
Entity Data Model (EDM)
![Page 17: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/17.jpg)
EDM in Action
Demo
![Page 18: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/18.jpg)
Entity Client & Object Services
![Page 19: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/19.jpg)
Entity Client EntityClient Provider for Entity Framework
System.Data.EntityClient
Abstracts DBMS Providers for Entity Framework Architecture
![Page 20: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/20.jpg)
Entity Client in Action
Demo
![Page 21: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/21.jpg)
Object Context
Entity Contain
er
Object Services
Entity Connection
Object Services
![Page 22: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/22.jpg)
Object Services in Action
Demo
![Page 23: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/23.jpg)
Break (30 minutes)
![Page 24: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/24.jpg)
LINQ to Entities & Entity SQL
![Page 25: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/25.jpg)
LINQ to Entities What is LINQ
◦ LINQ to Objects◦ LINQ to XML◦ LINQ to DataSets◦ LINQ to SQL◦ And more E.g. (LINQ to Twitter, LINQ to Flickr
etc…)
LINQ to Entities
![Page 26: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/26.jpg)
LINQ to Entities in Action
Demo
![Page 27: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/27.jpg)
Entity SQL (eSQL)
Supported NOT Supported
SQL based
Provider neutral
Supports EDM types
First class collections
Canonical functions
DML statements (insert,
update, delete)
DDL statement (create,
alter, drop)
Grouping functions (CUBE,
ROLLUP, GROUPING_SET
Does not support the *
construct
![Page 28: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/28.jpg)
Entity SQL in Action
Demo
![Page 29: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/29.jpg)
Entity SQL Vs LINQ to Entities
Dynamic queries (LINQ is compiled)
Store Function/Procedures is only supported in eSQL
![Page 30: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/30.jpg)
Load Related Objects
![Page 31: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/31.jpg)
Entity relation mapping (one to one, one to many, many to many)
Deferred Loading Vs Eager Loading Vs Explicit Loading
ObjectQuery<T> Class
EntityCollection<T> Class
EntityReference Class
Load Related Objects
![Page 32: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/32.jpg)
Load Related Objects in Action
Demo
![Page 33: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/33.jpg)
Inheritance in Entity Framework
![Page 34: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/34.jpg)
Inheritance in Entity Framework
Table-per-Hierarchy (TPH) Table-per-Type (TPT)
Table
Hierarchy
Table
Type
![Page 35: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/35.jpg)
One table in storage to maintain data for all the types in an inheritance hierarchy.
Table-per-Hierarchy (TPH)
![Page 36: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/36.jpg)
Separate table in storage to maintain data for each type in the inheritance hierarchy.
Table-per-Type (TPT)
![Page 37: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/37.jpg)
Inheritance in Action
Demo
![Page 38: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/38.jpg)
Entity Framework Providers
Multiple database support
![Page 39: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/39.jpg)
Entity Framework Providers◦ MySQL Connector\net (MySQL)◦ Devart (Oracle, MySQL, SQLite and PostgreSQL)◦ IBM (DB2, Informix and U2 databases)◦ Phoenix Software Solutions (SQLite)◦ Npgsql (PostgreSQL)◦ Sybase SQL Anywhere (SQL Anywhere 11)◦ Firebird (Firebird)◦ VistaDB (VistaDB 4.x)
Multiple Database Support in Entity Framework
![Page 40: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/40.jpg)
Multiple Database Support
Demo
![Page 41: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/41.jpg)
Entity Framework Limitations
![Page 42: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/42.jpg)
Known Issues and Considerations in LINQ to Entities◦ Ordering Information Lost◦ Nested Queries. Nested Queries May Fail with SQL
Server 2000◦ Unsigned Integers Not Supported◦ Enums not supported◦ Referencing Non-Scalar Closures Not Supported◦ Custom extension methods Not Supported◦ Some common sense methods not supported
(Single, SingleOrDefault)
Entity Framework Limitations
![Page 43: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/43.jpg)
Entity Framework VS.Net Designer Limitations
limitations in Entity SQL◦ DDL not supported◦ DML not supported (insert, update, delete)
Design issues◦ No Persistence Ignorance support a.k.a POCO◦ Leakage of Testability
I am sure there might be more
Entity Framework Limitations (Cont.)
![Page 44: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/44.jpg)
LINQPad eSQLBlast
◦ http://code.msdn.microsoft.com/esql/
External Tools
![Page 45: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/45.jpg)
References
![Page 46: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/46.jpg)
MSDN◦ Programming Guide (Entity Framework)◦ Load Related Objects (Entity Framework)◦ Inheritance in Entity Framework
TPH TPT
◦ Known Issues and Considerations in LINQ to Entities
◦ Entity Framework and LINQ to Entities Forums◦ ADO.NET Entity Framework and LINQ to Entities (P
re-Release) Forums
References
![Page 47: Introducing Entity Framework](https://reader035.vdocuments.site/reader035/viewer/2022081421/5561e866d8b42aa5068b50fd/html5/thumbnails/47.jpg)
Community◦ Zeeshan Hirani Entity Framework Learning Guide
Post PDF
◦ Gil Fink on Entity Framework◦ Moses’ blog on Entity Framework◦ Entity Framework Supported Mapping Scenarios
White Paper by Asad Khan
References (Cont.)