Examining OData – Windows Phone 7 Development — How to create your URI’s easily with LINQPad

Today the WCF Data Services team released a new update for the OData Client Library for Windows 7 (get a copy of the source here). There are some things that changed. Most notably, the ability to LINQ on the DataServiceContext created with the new version of the code generation tool. This new tool (get source here) creates a set of classes that allow developers to work with the OData feeds.

Now that LINQ’ing is not available what do we do? We will have to work with URI’s for our queries. This is not difficult but is not as easy as writing LINQ statements with Intellisense. One possible solution to to take your LINQ statements that you created for your Windows Phone 7 project and run them through LINQPad to get the URI that is the equivalent. LINQPad is a great learning tool for LINQ and also will give you some added information about your queries as we will see in this post.

Here is a screenshot using the Baseball Stats OData Feed. You can the LINQ statement to get the current active list baseball franchises from the feed.

image

Now you can run the LINQ query and get the results

image

The secret to getting the corresponding URI for the LINQ query is to then select the SQL on the Result toolbar

image

You will then see the URI equivalent for the LINQ statement you wrote above in the Query section.

image

Now you can take that URI and use it when working with the OData Client Library for Windows Phone 7.

2 thoughts on “Examining OData – Windows Phone 7 Development — How to create your URI’s easily with LINQPad

  1. Can you get the same results if you are creating a Silverlight application not to be used on the phone?

    If so, any examples available anywhere?

    Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *