现在如何使用响应式扩展而不使用 IEvent 从 OData feed 获取数据?
似乎 Microsoft 的 Reactive Extensions 团队从库中删除了 IEvent 接口,因此现在直到最近才运行的以下代码无法编译:
using ODataServiceReference;
public static IObservable<IEvent<LoadCompletedEventArgs>> GetInvoices(Uri uri)
{
var context = new ODataEntities(uri);
var invoices = new DataServiceCollection<ODataEntities.Invoice>(context);
var observable = Observable.FromEvent<LoadCompletedEventArgs>(
i => invoices.LoadCompleted += i,
i => invoices.LoadCompleted -= i);
var query = from i in context.Invoices
select i;
invoices.LoadAsync(query);
return observable;
}
我正在尝试发现从 WCF 数据服务 DataServiceCollection 对象获取查询结果的最佳方法。有什么想法吗?
Seems the Reactive Extensions team at Microsoft removed the IEvent interface from the library and so now the following code that worked until recently does not compile:
using ODataServiceReference;
public static IObservable<IEvent<LoadCompletedEventArgs>> GetInvoices(Uri uri)
{
var context = new ODataEntities(uri);
var invoices = new DataServiceCollection<ODataEntities.Invoice>(context);
var observable = Observable.FromEvent<LoadCompletedEventArgs>(
i => invoices.LoadCompleted += i,
i => invoices.LoadCompleted -= i);
var query = from i in context.Invoices
select i;
invoices.LoadAsync(query);
return observable;
}
I am trying to discover the best way to get the result of a query from a WCF Data Services DataServiceCollection object. Any thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需将
Observable.FromEvent
更改为Observable.FromEventPattern
即可再次编译。然而,您可能想考虑只选择好的部分:
Just change
Observable.FromEvent
toObservable.FromEventPattern
and you should be compiling again.You may want to consider selecting just the good bits however: