【发布时间】:2014-06-02 22:53:31
【问题描述】:
我正在使用指向 OData 端点的 WCF 数据服务。如果我使用 DataServiceQuery,我可以毫无困难地管理延续。
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);
但是,我不明白如何对 DataServiceContext.BeginExecute(string url, ...) 方法执行相同的操作。
_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
});
我怎样才能使用基于 url 的查询方法,但仍然获得延续支持?
【问题讨论】: