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. 

http://bit.ly/wp7odatalib

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:

clip_image002

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:

http://www.linqpad.net/

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:

http://stephenwalther.com/blog/archive/2010/04/01/netflix-jquery-jsonp-and-odata.aspx

http://stephenwalther.com/blog/archive/2010/03/30/using-jquery-and-odata-to-insert-a-database-record.aspx

Hope this helps save you some time!

Follow devkeydet on Twitter

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s