在WCF中可以将代理传递给远程对象? [英] In WCF is it possible to pass a delegate to the remote object?

查看:112
本文介绍了在WCF中可以将代理传递给远程对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以从客户端将代理传递给WCF远程对象,并让远程对象执行代理?

Is it possible to pass a delegate to a WCF remote object from the client and have the remote object execute the delegate?

我猜不会,因为delgate是一个用于客户端进程的函数指针。

I would guess not since a delgate is a function pointer for the client process.

我的目标是拥有一个可以从客户端到界面订阅事件的接口结构。我将从客户端传递到界面,我希望接口能够执行该事件。

My goal is to have an interface structure that I can "subscribe" to events from a client to the interface. I would pass a delgate from the client to the interface and I want the interface to be able to execute the event.

想法是让界面的能力加载程序集或远程加载代码工作相同。

The idea is to have the ability for the interface to be loaded either the assembly or remotly and have the code work the same.

如果我无法通过委托如何实现事件结构?

If I can't pass the delegate how can I implement an event structure?

推荐答案

不是C#中的委托本身,而在WCF中,您可以使用双工绑定来启用从服务端回调到客户端

not a "delegate" in C# per se, but in WCF you have duplex bindings to enable call back from the service side to the client side

http://msdn.microsoft.com/en-us/library/system.servicemodel.wsdualhttpbinding.aspx

这篇关于在WCF中可以将代理传递给远程对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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