View
237
Download
3
Tags:
Embed Size (px)
Citation preview
OData everywhere
Matt MilnerPluralsight
Overview
What and why of OData
OData client ecosystem
OData We need another data access
technology?
ODBCOLE DB
ADO RDO
ADO.NET
Linq to SQL EntityFramework
DataSetWhich of these is cross platform?
Open Data Protocol
Open: HTTP, ATOMPub, JSON
Data: Querying & updating
Protocol: Data format, uri constraints, metadata
ProtocolGET http://localhost/TaskService.svc/Tasks Accept: application/json
HTTP/1.1 200 OKDataServiceVersion: 1.0;Content-Length: 876Content-Type: application/json;charset=utf-8
{"d" : [ {"__metadata": {"uri": "http://localhost/TaskService.svc/Tasks(2)", "type": "TaskDBModel.Task"}, "TaskID": 2, "AssignedTo": "3", "DueDate": "\/Date(1298505600000)\/", "Description": "hire HR manager", "Priority": 1, "PercentComplete": 25 } ] }
POST http://localhost/TaskService.svc/Tasks HTTP/1.1Content-Type: application/jsonAccept: application/jsonContent-Length: 153
{"Description":“Fire Sally","Priority":1,"PercentComplete":25, "DueDate":"\/Date(1298505600000)\/","AssignedTo":"3"}
Protocol
HTTP/1.1 201 CreatedDataServiceVersion: 1.0;Content-Length: 297Location: http://localhost/TaskService.svc/Tasks(5)Content-Type: application/json;charset=utf-8{"d" : {"__metadata": {"uri": "http://localhost/TaskService.svc/Tasks(5)", "type": "TaskDBModel.Task"}, "TaskID": 5, "AssignedTo": "3", "DueDate": "\/Date(1298505600000)\/", "Description": “Fire Sally", "Priority": 1, "PercentComplete": 25}}
System query optionsOption Description Example
$filter Filters the result set /Movies?$filter=Title eq ‘Star Wars’
$orderby Sort the target resources /Movies?$orderby=Title desc
$top Return only the top n resources /Movies?$top=10/Movies?$orderby=Title&$top=5
$skip Skip the first n resources /Movies?$skip=100&$top=10
$select Create a projection /Movies(1)/’Reviews?$select=rating,reviewer
$inlinecount Includes the total count /Movies?$top=100&$inlinecount=allpages
$value Retrieve a value without any surrounding metadata
/Movies(2)/Title/$value
$expand Eager loading of specified elements
/Movies(1)?$expand=Reviews
OData producers
Producers
• SharePoint 2010• SQL Azure• Azure Table Storage• IBM WebSphere• Data Market• . . .
Services
• Ebay• Facebook• Netflix• Pluralsight
OData clients
Windows
.NET
Silverlight
PowerPivot
Browsers
Atom
JavaScript
jQuery
Open Source
PHP
Ruby
Java
Mobile
Win Phone 7
IPhone / IPad (objective C)
Android
Windows / .NET Add Service
Reference Managed data
context Full batching
support Databinding
Silverlight DataServiceCollection –
async load Out of browser support Browser or custom
credentials (OOB)
PowerPivot Analytics Charting Relationships
Browsers JSON / ATOM JavaScript
library
Open source Ruby = gem install
ruby_odata Java = RestLet extension PHP = PHPDataSvcUtil
Phones Native libraries for Mac
and WP7 Restlet / java support on
Android
© 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and
Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.