OData everywhere Matt Milner Pluralsight
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 Entity Framework DataSet Which of these is cross platform?
Open Data Protocol Open : HTTP, ATOMPub, JSON Data : Querying & updating Protocol : Data format, uri constraints, metadata
Protocol GET Accept: application/json GET Accept: application/json HTTP/ OK DataServiceVersion: 1.0; Content-Length: 876 Content-Type: application/json;charset=utf-8 {"d" : [ { "__metadata": { "uri": " "type": "TaskDBModel.Task" }, "TaskID": 2, "AssignedTo": "3", "DueDate": "\/Date( )\/", "Description": "hire HR manager", "Priority": 1, "PercentComplete": 25 } ] } HTTP/ OK DataServiceVersion: 1.0; Content-Length: 876 Content-Type: application/json;charset=utf-8 {"d" : [ { "__metadata": { "uri": " "type": "TaskDBModel.Task" }, "TaskID": 2, "AssignedTo": "3", "DueDate": "\/Date( )\/", "Description": "hire HR manager", "Priority": 1, "PercentComplete": 25 } ] }
POST HTTP/1.1 Content-Type: application/json Accept: application/json Content-Length: 153 {"Description":“Fire Sally","Priority":1,"PercentComplete":25, "DueDate":"\/Date( )\/","AssignedTo":"3"} POST HTTP/1.1 Content-Type: application/json Accept: application/json Content-Length: 153 {"Description":“Fire Sally","Priority":1,"PercentComplete":25, "DueDate":"\/Date( )\/","AssignedTo":"3"} Protocol HTTP/ Created DataServiceVersion: 1.0; Content-Length: 297 Location: Content-Type: application/json;charset=utf-8 { "d" : { "__metadata": { "uri": " "type": "TaskDBModel.Task" }, "TaskID": 5, "AssignedTo": "3", "DueDate": "\/Date( )\/", "Description": “Fire Sally", "Priority": 1, "PercentComplete": 25}} HTTP/ Created DataServiceVersion: 1.0; Content-Length: 297 Location: Content-Type: application/json;charset=utf-8 { "d" : { "__metadata": { "uri": " "type": "TaskDBModel.Task" }, "TaskID": 5, "AssignedTo": "3", "DueDate": "\/Date( )\/", "Description": “Fire Sally", "Priority": 1, "PercentComplete": 25}}
System query options OptionDescriptionExample $filterFilters the result set/Movies?$filter=Title eq ‘Star Wars’ $orderbySort the target resources/Movies?$orderby=Title desc $topReturn only the top n resources/Movies?$top=10 /Movies?$orderby=Title&$top=5 $skipSkip the first n resources/Movies?$skip=100&$top=10 $selectCreate a projection/Movies(1)/’Reviews?$select=rating,review er $inlinecountIncludes the total count/Movies?$top=100&$inlinecount=allpages $valueRetrieve a value without any surrounding metadata /Movies(2)/Title/$value $expandEager 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.NETSilverlightPowerPivot Browsers AtomJavaScriptjQuery Open Source PHPRubyJava 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.