Entity Framework and ADO.NET Data Services Chad Brooks Architect Evangelist http://blogs.msdn.com/chabrook [email protected] ADO.NET Entity Framework Entity Data Model Entity Framework Visual Studio Designer Support.

Download Report

Transcript Entity Framework and ADO.NET Data Services Chad Brooks Architect Evangelist http://blogs.msdn.com/chabrook [email protected] ADO.NET Entity Framework Entity Data Model Entity Framework Visual Studio Designer Support.

Entity Framework and ADO.NET
Data Services
Chad Brooks
Architect Evangelist
http://blogs.msdn.com/chabrook
[email protected]
ADO.NET Entity Framework
Entity Data Model
Entity Framework
Visual Studio Designer Support
ADO.NET Entity Data Model
Maps concepts to physical store
Conceptual Schema Definition
Storage Schema Definition
Mapping Specification
Decouples your DB schema from your application
model
Provides flexibility
Platform-independent
ADO.NET Entity Framework
Entity Framework
Object Services
Entity Client
EntitySQL
Linq-to-Entities
Visual Studio Designer Support
Visual Studio Support
Entity Data Model Wizard
Simplifies creation of mapping files
Data Model Design Surface
Simplifies creation of entities and relationships
Hides the complexity of the mapping files
Demo….
Demo: ADO.NET Entity Framework
Why Data Services?
HTML +
Javascript
DLL + XAML
Data (XML,JSON,…)
Data (XML,JSON,…)
AJAX
Silverlight
Applications Applications
Mashup UI
Data (XML,JSON,…)
Online
Services
Data
Feeds
Mashups
A RESTful Interface for Data
Just HTTP
• Data as resources, HTTP methods to act on it
• Leverage caching, proxies, authentication, …
Uniform URL syntax
• Every piece of information is addressable
• Predictable and flexible URL syntax
Multiple representations
• Use regular HTTP content-type negotiation
• Atom*, JSON and Plain XML
• *full AtomPub protocol support
Demo….
ADO.Net Data Services
Model and Operation Semantics
Underlying data model
Entity Data Model
Entities  Resources
Associations  Links
Operation semantics
Usual mapping of HTTP methods
GET  retrieve resource
POST  create resource
PUT  update resource
DELETE  delete resource
URL Conventions
Addressing entities and sets
Entity-set
/Bookmarks
Single entity
/Bookmarks(123)
Member access
/Bookmarks(123)/Name
Link traversal
/Bookmarks(123)/Tags
Deep access
/Bookmarks(123)/Tags('abc')/Name
Raw value access
/Bookmarks(123)/Names/$value
Presentation options
Sorting
/Bookmarks?$orderby=Name
Filtering
/Bookmarks?$filter=Created gt '2007-05-07'
Paging
/Bookmarks?$top=10&$skip=30
Inline expansion
/Bookmarks?$expand=Tags
Creating Data Services
HTTP
Create services directly
from Visual Studio
Hosting/HTTP listener
Service Runtime
Various data sources
Entity Framework
LINQ providers
Model-driven
IQueryable [+ IUpdatable]
Data Access Layer
Entity
Framework
Custom LINQ
provider
Structural description in
Entity Data Model
Metadata shapes service
Relational
database
Other
sources
Refining and Securing Services
Visibility
• Per-container visibility control
• Read, Query and Write options
Authentication
• Integrate with hosting environment
• ASP.NET, WCF or custom authentication schemes
Interceptors
• Execute before HTTP GET/PUT/POST/DELETE
• Enable validation, custom row-level security policies
• Maintain the REST interface
Service Operations
• Custom entry points, e.g. /MyTags?startDate='2007-01-01'
• Composable, follow URI scheme
Demo….
Security and Interceptors
"Traditional" Applications
Web applications
Data services client can be used in ASP.NET
ASP.NET data source control for accessing
remote services
Desktop applications
Fully-featured .NET client library
Same API in desktop and Silverlight
environments
Modern Data-Driven Web Apps
AJAX integration
AJAX-friendly JSON format in services
Javascript library that integrates with the
ASP.NET AJAX toolkit
Silverlight support
.NET programming model for data services
Object based, LINQ enabled API
Code-gen entity types from metadata
Demo….
Calling Data Services from clients…
Resources
ADO.NET Data Services Framework
blogs
http://blogs.msdn.com/astoriateam
http://blogs.msdn.com/pablo
Data Frameworks - http://msdn.microsoft.com/enus/data/
“How Do I?” videos - http://msdn.microsoft.com/enus/data/cc300162.aspx
AJAX Client Library - http://quickstarts.asp.net/3-5extensions/adonetdataservice/default.aspx
Silverlight Client Library (Download Silverlight2 SDK) http://www.microsoft.com/downloads/details.aspx?Family
Id=CF8F88C3-D869-46DE-A7BFFB7712C791B7&displaylang=en