我们如何使用RX框架WCF在长时间运行的过程,频繁的UI选择更新? [英] How we can use RX framework in WCF for long running process and frequent UI updation?

查看:184
本文介绍了我们如何使用RX框架WCF在长时间运行的过程,频繁的UI选择更新?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我来了解接收框架,似乎非常有前途的。我在这一个疑问。从我的UI假设[可这是的WinForms或网页]我拨打电话到互联网服务和发送列表。所以,我的电话是一样 - > myWCFServiceMethod(列表empLists)。这里面的服务方式,为每一位员工的对象,我需要重新再拍服务电话,并得到了它的结果,并做一些数据库操作[降耗和选择更新],最后发送回每个员工到客户端的状态。在列出了每个员工,我必须做并行操作相同。没有连续的顺序。

Recently i came to know about Rx framework and seems very promising. I have a doubt in it. Suppose from my UI [may it be winforms or web pages], i make a call to webservice and sending a List. So my calls is like --> myWCFServiceMethod(List empLists). Inside this service methods, for each employee object, i need to make again another service calls and get the result of it and do some kind of DB operations [saving and updation] and finally sends back the status of each employee to the client side. For each employee in the lists, i have to do the same operation parallel. There is no sequential order.

这有可能与接收框架?这样做,我应该需要实现对每个员工的状态更新回客户端UI回调合同?

Is that possible with Rx framework ? For doing this, should I need to implement callback contracts for each employees status updation back to client UI ?

我所做的UI使用DataGrid和DataGrid中有2列。 firts是员工姓名和第二个是状态栏。

I made the UI with a datagrid and the datagrid has 2 columns. firts is the employee name and second is the status column.

当加载UI时,我装100员工在网格中。然后点击启动按钮。所以,我收拾了所有的员工对象到一个列表并将该列表的web服务的方法。

when UI loads, i loaded with 100 employee in the grid. Then clicks on the start button. So I packed up all the employee object into a list and sends that lists to the webservice method.

现在,我期待的事情要做这是状态更新当员工经过不同工艺的每个过程。像并行处理。没有连续的过程。如果某些员工的对象可以提前完成工作和其他一些需要一定的时间。所以没有过程的顺序。任何员工都可以调用它自己相关的外部Web服务调用,并从中得到结果。其中它得到了这样的结果,它将尝试保存或更新数据库。对于所有这些过程,我希望得到通知雇员的每个过程的状态正在经历最后完成其工作。

Now, i am looking for the things to do which is the status updation of each process when an employee goes through different process. Something like parallel process. There is no sequential process. If some employee object can finish its work early and some others will take some time. SO there is no order of process. Any employee can call its own associated external web service call and gets the result from it. One it got such a result, it then tries to save or update the DB. For all these process, I want to get notified the status of each process of an employee is going through and finally it finishes its work.

我不明白,无需回调契约接收如何能做到这一点?

I dont understand without having callback contract how Rx can do this ?

我没有看到我们如何能做到这一点任何similiar类型的教程或指导。

I didnt see any similiar type of tutorials or guidance for how we can do it.

请指导我正确的方法。

非常感谢。

推荐答案

下面是一个简单的回答你的问题。

Here's a quick answer to your question.

要在平行的多个服务呼叫,然后得到的结果,因为他们返回你需要这样的查询:

To make multiple service calls in parallel and then get the results as they return you need a query like this:

var query =
    from index in indexes.ToObservable()
    from result in webServiceCall(index)
    select new { index, result };



webServiceCall 签名看起来像的IObservable< R> 。webServiceCall(I指数)

然后,执行与查询:

query.Subscribe(ir =>
{
    // Do stuff with ir.index and ir.result
});



专注于实施 webServiceCall ,以适应这个代码。我希望这给你一个起点。

Focus on implementing webServiceCall to fit this code. I hope this gives you a starting point.

这篇关于我们如何使用RX框架WCF在长时间运行的过程,频繁的UI选择更新?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆