OData everywhere

triangledriprockInternet and Web Development

Aug 7, 2012 (4 years and 8 months ago)

398 views

OData everywhere

Matt Milner

Pluralsight

Overview

What and
why of OData

OData client
ecosystem

OData

We need another data access technology?

ODBC

OLE DB

ADO

RDO

ADO.NET

Linq

to SQL

Entity

Framework

DataSet

Which of these is cross platform?

O
pen
Data
Protocol

O
pen
: HTTP,
ATOMPub
, JSON

Data
: Querying & updating

Protocol
: Data format,
uri

constraints, metadata

Protocol

GET
http://
localhost/TaskService.svc/Tasks

Accept: application/
json

HTTP/1.1 200 OK

DataServiceVersion
: 1.0;

Content
-
Length: 876

Content
-
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.1

Content
-
Type
:
application/
json

Accept: application/
json

Content
-
Length
: 153


{"
Description
":“Fire

Sally","
Priority":1,"PercentComplete":25
,
"
DueDate":"
\
/Date(1298505600000)
\
/","AssignedTo
":"3"}

Protocol

HTTP/1.1 201 Created

DataServiceVersion
: 1.0;

Content
-
Length: 297

Location: 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 options

Option

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=
ra瑩湧,re癩vw
er

$
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 registere
d t
rademarks 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
dat
e 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 Mic
ros
oft 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.