OData client libraries for .NET 4, Silverlight 4 and Windows Phone 7

http://odata.codeplex.com/releases/view/54698

ODataNetFx4_SL4_WinPhone7_Client.zip – contains a Visual Studio 2010 solution with the source code for the OData .NET 4, Silverlight 4 and Windows Phone 7 Client library. To use, unzip the file locally and open the solution in Visual Studio 2010.
ODataClient_BinariesAndCodeGenToolForWinPhone.zip – contains just the OData client assemblies and code generation tools for use on Windows Phone 7.
ODataClient_WinPhone7SampleApp.zip – contains a sample Windows Phone 7 application which uses the OData client library for Windows Phone 7

A quick tour of OData using Netflix

image

OData is a web protocol based on open standards for RESTful querying and modification of exposed collections of data. It takes the basics of REST and adds mechanisms for addressing, metadata, batching, and data representation using HTTP, AtomPub, Atom and JSON.

Try to locate Nicole Kidman:

http://odata.netflix.com/Catalog/People?$filter=endswith(Name,’Kidman’)

Too many Kidmans? Choose the top record:

http://odata.netflix.com/Catalog/People?$filter=endswith(Name,’Kidman’)&$top=1

Not perhaps the best way of finding Nicole (‘Papa?’), use the primary key instead:

http://odata.netflix.com/Catalog/People(49446)

Which films has Nicole been in? Who could forget the classic “Days of Thunder” with Tom Cruise as “Cole Trickle”:

http://odata.netflix.com/Catalog/People(49446)/TitlesActedIn

What if I wanted Nicole’s info as well as the titles she’s acted in?:

http://odata.netflix.com/Catalog/People(49446)?$expand=TitlesActedIn

Too much data? Sort these titles alphabetically and return the first page of data for a page size of 3:

http://odata.netflix.com/Catalog/People(49446)/TitlesActedIn?$orderby=ShortName&$top=3

But to do paging I’ll be needing the total record count (notice m:count element with value 47):

http://odata.netflix.com/Catalog/People(49446)/TitlesActedIn?$orderby=ShortName&$top=3&$inlinecount=allpages

Next page:

http://odata.netflix.com/Catalog/People(49446)/TitlesActedIn?$orderby=ShortName&$top=3&$inlinecount=allpages&$skip=3

Prefer JSON? Well, there’s no accounting for taste but I know “Cole Trickle” preferred it too:

http://odata.netflix.com/Catalog/People(49446)/TitlesActedIn?$orderby=ShortName&$top=3&$inlinecount=allpages&$skip=3&$format=json

For more including exposing and consuming OData goto ->

 OData: The Open Data Protocol – Mike Taulty’s Blog – Mike Taulty’s Blog