Data Services (OData) Client for Windows Phone 7 and LINQ


The WCF Data Services Team released a client library to make it easier to interact with OData services from Windows Phone 7.

The major caveat (and bummer) with the library is that “LINQ support in the client library has been removed as the core support is not yet available on the phone platform.”  I have a tip/trick for LINQ lovers like me that will allow you to still use LINQ query syntax to compose your query (kind/sorta).  A tool I find useful to when writing OData queries on Windows Phone 7 is LINQPad.  I use the tool to write LINQ queries against my data service, then get the url syntax query translated for me:


Once I get my LINQ query right, I just paste the http string into my app.  I’m still surprised about how many people aren’t aware of LINQPad.  You must check it out if you use LINQ in your day to day coding (which I am sure most of you do now).  You can learn more about using LINQPad against OData services (amongst many other uses) from the product site:

NOTE: This tip/trick is very useful when querying OData services from JavaScript as well.  Here are two helpful posts on using jQuery to interact with an OData service:

Hope this helps save you some time!

Follow devkeydet on Twitter

Comments (2)

  1. Mike Hole says:


    This is a great idea and one that I saw with relief so I had to give it a try.

    But I have found a few problems with joins in the query’s.  An example is using the TwitPic OData service ( If the query has the following form:

    (from I in Images where I.User.UserName == "mikehole" select I).Take(20)

    This gives the following Uri:$filter=User/UserName eq 'mikehole'&$top=20

    From this I get an exception with the following message:

    Enumerating all the images is not allowed, you can access them by user, event, tag or place.

    This may be a problem with the way that the OData service processes the query but it would be better if the query was formed like this:$top=20

    Looks like we are close but unless the OData service has a solid implementation of the $filter functions we still don’t get the cigar.

  2. devkeydet says:

    You are correct.  Not all OData services implement the whole spec so we are at the mercy of the service.…/protocols

    For example, Windows Azure Table Storage is exposed as an OData Service.  However, they only support a subset of the query capabilities of a "fully implemented" OData service.

Skip to main content