Vous êtes sur la page 1sur 31

building software to help our clients grow SINCE 1985

Entity Framework 4 and WCF Data Services 4


Max Weber - Senior Consultant

www.tallan.com

Presentation Goals

Get

started with Entity Framework 4 Get started with WCF Data Services 4 Create website iBlog

Tallan, Inc. Proprietary and Confidential. Copyright 2010.

12/4/2012

Presentation Agenda

Entity

Data Model Entity Framework 4


Open

up Visual Studio up Visual Studio

WCF

Data Services 4 / Questions

Open

Summary Cake

Tallan, Inc. Proprietary and Confidential. Copyright 2010.

12/4/2012

What is the Entity Data Model?

Entity
The

Data Model

Entity Data Model (EDM) is a set of concepts that describe the structure of data, regardless of its stored form. The EDM borrows from the Entity-Relationship Model described by Peter Chen in 1976, but it also builds on the Entity-Relationship Model and extends its traditional uses. Extensions to E-R Model:

Separation of the entities and relationships from their storage medium

http://msdn.microsoft.com/en-us/library/ee382825.aspx
12/4/2012

Tallan, Inc. Proprietary and Confidential. Copyright 2010.

Entity Data Model Key Concepts

Entity

Type
key, inheritance, entity Sets, entity container

entity

Association
foreign

Type

key, multiplicity, navigation properties, association set, entity container

Property
Boolean,

Int32, String DateTime, Guid, Binary Complex Types

Tallan, Inc. Proprietary and Confidential. Copyright 2010.

12/4/2012

Entity Framework Overview

Entity Framework Overview

Tallan, Inc. Proprietary and Confidential. Copyright 2010.

12/4/2012

Entity Framework 4

Conceptual

Model Storage Model Data Providers

Tallan, Inc. Proprietary and Confidential. Copyright 2010.

12/4/2012

Conceptual Model Entity Framework 4

Conceptual

schema definition language (CSDL) Conceptual model == Domain model .csdl file extension CSDL is Entity Frameworks implementation of the Entity Data Model

Tallan, Inc. Proprietary and Confidential. Copyright 2010.

12/4/2012

Storage Model Entity Framework 4

Store

schema definition language (SSDL) Storage model == Logical model Storage models are provider-specific .ssdl file extension

Tallan, Inc. Proprietary and Confidential. Copyright 2010.

12/4/2012

10

Mapping Concepts to Storage EF4

Mapping

specification language (MSL) Maps between conceptual and storage models .msl file extension

Tallan, Inc. Proprietary and Confidential. Copyright 2010.

12/4/2012

11

Providers Entity Framework 4

EF

uses the ADO.NET Data Provider model


MS SQL Server

Providers
Indirect access to other DBs using ODBC, OLEDB

VistaDB Devart OpenLink Software Synergy 5+ more

ADO.NET

Data Providers List

http://msdn.microsoft.com/en-us/data/dd363565.aspx
12/4/2012

Tallan, Inc. Proprietary and Confidential. Copyright 2010.

12

Entity Data Model Tools

Entity

Data Model Wizard ADO.NET Entity Data Model Designer Update Model Wizard Command line tool EDM Generator (EdmGen.exe)

Tallan, Inc. Proprietary and Confidential. Copyright 2010.

12/4/2012

13

Class Generation Entity Framework

T4

Templates used to generate Entity classes from CSDL Entities based on EntitySet
Tied

to .NET, System.Data POCO extension from Visual Studio Gallery

Plain

Old CLR Objects (POCO)

Need

POCO

Proxy Extensions from Visual Studio Gallery


ADO.NET

POCO Entity Generator Tangible T4 Editor


Tallan, Inc. Proprietary and Confidential. Copyright 2010. 12/4/2012

14

Code Time! Entity Framework 4

Tallan, Inc. Proprietary and Confidential. Copyright 2010.

12/4/2012

15

Entity Framework: Recap

Tallan, Inc. Proprietary and Confidential. Copyright 2010.

12/4/2012

16

WCF Data Services

Formerly
WCF

.NET Data Services (aka Astoria) Description:


Data Services enables creation and consumption of data services for the Web or an intranet by using the Open Data Protocol (OData).

Architecture Overview : WCF Data Services

RESTful work WCF Data Services

Exposes

data as resources (URI)

http://localhost/Northwind.svc/Customers(ALFKI) http://localhost/Northwind.svc/Customers('ALFKI')/Orders?$

filter=Freight gt 50

Tallan, Inc. Proprietary and Confidential. Copyright 2010.

12/4/2012

19

Open Data Protocol (OData)

Definition
OData

enables you to expose your data as resources that are addressable by URIs Enables you to access and change data by using the semantics of representational state transfer (REST) Standard HTTP verbs supported:

GET, PUT, POST, DELETE.

Reference: WCF Data Services Overview http://msdn.microsoft.com/library/cc668794.aspx

Output Formats WCF Data Services

Atom JSON XML

Tallan, Inc. Proprietary and Confidential. Copyright 2010.

12/4/2012

21

Freedom of data source WCF Data Services

Entity

Framework Provider
Entity Data Models to structure access

Uses

Reflection
Exposes

Provider
data structures with interface IQueryable

Create/Update/Delete with interface IUpdatable

Custom
Roll

Provider

your own

Link

to WCF Data Services Providers

http://msdn.microsoft.com/en-us/library/dd672591.aspx

Tallan, Inc. Proprietary and Confidential. Copyright 2010.

12/4/2012

22

Custom Business Logic WCF Data Services

Service
Act

Operators

at a service level at an entity set level

Interceptors
Act

Tallan, Inc. Proprietary and Confidential. Copyright 2010.

12/4/2012

23

Client Libraries WCF Data Services

WCF

Data Services Client Library

.NET

Framework Silverlight
OData
PHP Java Ruby Windows

SDK
(AJAX)

Javascript

Phone 7 (not yet released) Objective-C (iPhone) (not yet released)


Tallan, Inc. Proprietary and Confidential. Copyright 2010. 12/4/2012

24

Code Time! WCF Data Services

Tallan, Inc. Proprietary and Confidential. Copyright 2010.

12/4/2012

25

WCF Data Services Atom feeds in IE

OOTB

IE Experience with WCF DS Atom feeds bad Make this change to see Atom feeds properly:
Tools->

Internet Options -> Feeds and Web Slices (Settings)


Uncheck Turn on feed reading view

Tallan, Inc. Proprietary and Confidential. Copyright 2010.

12/4/2012

26

Recap: WCF Data Services

In Summary

Entity

Data Model Entity Framework 4


Conceptual

Model Storage Model Class generation using T4 Templates


WCF

Data Services 4

OData

v2 RESTful services Multiple Data Providers Multiple Output formats


Tallan, Inc. Proprietary and Confidential. Copyright 2010. 12/4/2012

28

Distribution of slide deck

This

slide deck will be made available from the following locations:


Tallan

blogs - blogs.tallan.com CTDOTNET www.ctdotnet.org

Resources and Questions? Then Cake


Visual Studio Gallery Visual Studio - Entity Framework 4.0 and WCF Data Services 4.0 in Visual Studio 2010 What's New and Cool in Entity Framework 4.0 DevelopMentor ADO.NET Entity Framework Entity Framework At-a-Glance WCF Data Services WCF Data Services Overview WCF (ADO.NET) Data Services At-a-Glance Data Development Videos Programming Entity Framework Don't Be Iffy (Julie Lerman)

Its time for cake!

Tallan, Inc. Proprietary and Confidential. Copyright 2010.

12/4/2012

31

Vous aimerez peut-être aussi