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.
7/31/2017
2
Presentation Agenda
Entity
Data Model
Entity Framework 4
Open
WCF
up Visual Studio
Data Services 4
Open
up Visual Studio
Summary
/ Questions
Cake
Tallan, Inc. Proprietary and Confidential. Copyright 2010.
7/31/2017
What is the Entity Data Model?
Entity
Data Model
The
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
Tallan, Inc. Proprietary and Confidential. Copyright 2010.
7/31/2017
4
Entity Data Model Key Concepts
Entity
Type
entity
key, inheritance, entity Sets, entity container
Association
Type
foreign
key, multiplicity, navigation properties,
association set, entity container
Property
Boolean,
Int32, String
DateTime, Guid, Binary
Complex Types
Tallan, Inc. Proprietary and Confidential. Copyright 2010.
7/31/2017
5
Entity Framework Overview
Entity Framework Overview
Tallan, Inc. Proprietary and Confidential. Copyright 2010.
7/31/2017
7
Entity Framework 4
Conceptual
Model
Storage Model
Data Providers
Tallan, Inc. Proprietary and Confidential. Copyright 2010.
7/31/2017
8
Conceptual Model – Entity Framework 4
Conceptual
schema definition language (CSDL)
Conceptual model == Domain model
.csdl file extension
CSDL is Entity Framework’s implementation of the
Entity Data Model
Tallan, Inc. Proprietary and Confidential. Copyright 2010.
7/31/2017
9
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.
7/31/2017
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.
7/31/2017
11
Providers – Entity Framework 4
EF
uses the ADO.NET Data Provider model
Providers
MS SQL Server
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
Tallan, Inc. Proprietary and Confidential. Copyright 2010.
7/31/2017
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.
7/31/2017
13
Class Generation – Entity Framework
T4
Templates used to generate Entity classes from
CSDL
Entities based on EntitySet
Tied
Plain
to .NET, System.Data
Old CLR Objects (POCO)
Need
POCO extension from Visual Studio Gallery
POCO
Proxy
Extensions from Visual Studio Gallery
ADO.NET
POCO Entity Generator
Tangible T4 Editor
Tallan, Inc. Proprietary and Confidential. Copyright 2010.
7/31/2017
14
Code Time! – Entity Framework 4
Tallan, Inc. Proprietary and Confidential. Copyright 2010.
7/31/2017
15
Entity Framework: Recap
Tallan, Inc. Proprietary and Confidential. Copyright 2010.
7/31/2017
16
WCF Data Services
Formerly
.NET Data Services (aka Astoria)
Description:
WCF
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.
7/31/2017
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.
7/31/2017
21
Freedom of data source – WCF Data Services
Entity
Framework Provider
Uses
Entity Data Models to structure access
Reflection
Provider
Exposes data
structures with interface IQueryable
Create/Update/Delete with interface IUpdatable
Custom
Roll
Link
Provider
your own
to WCF Data Services Providers
http://msdn.microsoft.com/en-us/library/dd672591.aspx
Tallan, Inc. Proprietary and Confidential. Copyright 2010.
7/31/2017
22
Custom Business Logic – WCF Data Services
Service
Act
Operators
at a service level
Interceptors
Act
at an entity set level
Tallan, Inc. Proprietary and Confidential. Copyright 2010.
7/31/2017
23
Client Libraries – WCF Data Services
WCF
Data Services Client Library
.NET
Framework
Silverlight
OData
SDK
Javascript (AJAX)
PHP
Java
Ruby
Windows Phone
7 (not yet released)
Objective-C (iPhone) (not yet released)
Tallan, Inc. Proprietary and Confidential. Copyright 2010.
7/31/2017
24
Code Time! – WCF Data Services
Tallan, Inc. Proprietary and Confidential. Copyright 2010.
7/31/2017
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.
7/31/2017
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.
7/31/2017
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)
It’s time for cake!
Tallan, Inc. Proprietary and Confidential. Copyright 2010.
7/31/2017
31
© Copyright 2026 Paperzz