我正在使用指向OData端点的WCF数据服务。如果我使用DataServiceQuery,则可以毫无困难地管理延续。如何使用URL查询处理WCF-OData中的延续?
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做同样的(字符串的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的查询方法,但仍然得到延续支持?
谢谢你,为我工作。 – EndangeredMassa 2011-04-01 21:11:02