I am working with a WCF Data Service pointing to an OData endpoint. If I use a DataServiceQuery, I can manage the continuation without any trouble.
var collection = new DataServiceCollection<T>();
collection.LoadCompleted += (sender, e) =>
{
if (e.Error != null)
{
callback(null, e.Error);
return;
}
var thisCollection = (DataServiceCollection<T>) sender;
if (thisCollection.Continuation != null)
{
thisCollection.LoadNextPartialSetAsync();
}
else
{
var items = thisCollection.ToList();
callback(items, e.Error);
}
};
collection.LoadAsync(query);
However, I don’t see how you can do the same for a DataServiceContext.BeginExecute(string url, …) method.
_odataContext.BeginExecute<T>(new Uri(requestUrl), x =>
{
var items = _odataContext.EndExecute<T>(x);
//not sure how to get the rest of the items with this method
});
How can I use the url-based query method but still get continuation support?
A synchronous sample (to make it simpler):
In short, the Execute method returns instance of QueryOperationResponse, which implements IEnumerable but also exposes the continuation.