introducing entity framework

47
Introducing Entity Framework EF v1.0

Upload: bishoy-demian

Post on 24-May-2015

21.193 views

Category:

Technology


0 download

DESCRIPTION

this is an introduction session about Microsoft Entity Framework 4.0

TRANSCRIPT

Page 1: Introducing Entity Framework

Introducing Entity Framework

EF v1.0

Page 2: Introducing Entity Framework

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

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

History of ADO .Net

Page 5: Introducing Entity Framework

•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

•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

•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

Object Relational Mapping

{ORM}

Page 9: Introducing Entity Framework

Definition

ORM & Visual Studio

External Tools & frameworks for .Net

ORM Basics & Concepts

Page 10: Introducing Entity Framework

What is Entity Framework?

Why it is considered an ORM?

Page 11: Introducing Entity Framework

What is Entity Framework?

An ORM framework, Why?

Database Independent

Extensible

Part of Microsoft .Net framework 3.5 SP1

Page 12: Introducing Entity Framework

Getting Started

Demo

Page 13: Introducing Entity Framework

Entity Framework Architecture

Page 14: Introducing Entity Framework

Entity Framework Architecture

Page 15: Introducing Entity Framework

Entity Data Model (EDM)

What is Entity Data Mode?

Page 16: Introducing Entity Framework

SSDL

MSL

CSDL

Entity Data Model (EDM)

Page 17: Introducing Entity Framework

EDM in Action

Demo

Page 18: Introducing Entity Framework

Entity Client & Object Services

Page 19: Introducing Entity Framework

Entity Client EntityClient Provider for Entity Framework

System.Data.EntityClient

Abstracts DBMS Providers for Entity Framework Architecture

Page 20: Introducing Entity Framework

Entity Client in Action

Demo

Page 21: Introducing Entity Framework

Object Context

Entity Contain

er

Object Services

Entity Connection

Object Services

Page 22: Introducing Entity Framework

Object Services in Action

Demo

Page 23: Introducing Entity Framework

Break (30 minutes)

Page 24: Introducing Entity Framework

LINQ to Entities & Entity SQL

Page 25: Introducing Entity Framework

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

LINQ to Entities in Action

Demo

Page 27: Introducing Entity Framework

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

Entity SQL in Action

Demo

Page 29: Introducing Entity Framework

Entity SQL Vs LINQ to Entities

Dynamic queries (LINQ is compiled)

Store Function/Procedures is only supported in eSQL

Page 30: Introducing Entity Framework

Load Related Objects

Page 31: Introducing Entity Framework

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

Load Related Objects in Action

Demo

Page 33: Introducing Entity Framework

Inheritance in Entity Framework

Page 34: Introducing Entity Framework

Inheritance in Entity Framework

Table-per-Hierarchy (TPH) Table-per-Type (TPT)

Table

Hierarchy

Table

Type

Page 35: Introducing Entity Framework

One table in storage to maintain data for all the types in an inheritance hierarchy.

Table-per-Hierarchy (TPH)

Page 36: Introducing Entity Framework

Separate table in storage to maintain data for each type in the inheritance hierarchy.

Table-per-Type (TPT)

Page 37: Introducing Entity Framework

Inheritance in Action

Demo

Page 38: Introducing Entity Framework

Entity Framework Providers

Multiple database support

Page 39: Introducing Entity Framework

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

Multiple Database Support

Demo

Page 41: Introducing Entity Framework

Entity Framework Limitations

Page 42: Introducing Entity Framework

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

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

LINQPad eSQLBlast

◦ http://code.msdn.microsoft.com/esql/

External Tools

Page 45: Introducing Entity Framework

References

Page 46: Introducing Entity Framework

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