I am working on an application for Windows Phone 7 that makes asynchronous queries to OData. I use the following general form for the query:
DataServiceQuery<Entity> query = ourEntities.CreateQuery<Entity>("Entities");
entities.BeginExecute(QueryComplete, query);
I am having trouble adding filters to these queries, though. Using LINQ did not seem to be an option for asynchronous queries, so I tried adding OData filters using the AddQueryOption method mentioned in this article (trying to get results for when the Id is 1):
query.AddQueryOption("$filter", "Id eq 1");
If we take the URL from the async result and paste it into a browser, it works properly and returns the expected result. However, attempting to evaluate the result of the query always seems to result in a NotSupportedException with no message or inner stack trace.
Ideally, I'd like to be able to use LINQ, like Scott Hanselman did in his blog post about OData. If that is not an option for asynchronous data retrieval, how can I achieve filtering on the query?