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.
Now you can run the LINQ query and get the results
The secret to getting the corresponding URI for the LINQ query is to then select the SQL on the Result toolbar
You will then see the URI equivalent for the LINQ statement you wrote above in the Query section.
Now you can take that URI and use it when working with the OData Client Library for Windows Phone 7.