简体   繁体   English

与WCF服务共享活动

[英]Sharing event with WCF Service

I would like to share the event 'MyEvent' in the following class: 我想在以下课程中分享事件“ MyEvent”:

[ServiceContract]    
    public interface MyInterface
    {

     [OperationContract]
     void Start(); 

     event EventHandler<MyEventArgs> MyEvent;
    }

    public class MyEventArgs:EventArgs
    {
      public string Name{set;get;}
    }

Which Attribute should I add to MyEvent event and to the MyEventArgs class and its members? 我应将哪个属性添加到MyEvent事件以及MyEventArgs类及其成员?

Thanks in advance!!! 提前致谢!!!

Events are not the way to communicate back to the client in WCF. 在WCF中,事件不是传递回客户端的方法。 In WCF you use callbacks. 在WCF中,您使用回调。 See http://msdn.microsoft.com/en-us/magazine/cc163537.aspx#S2 and http://msdn.microsoft.com/en-us/library/system.servicemodel.servicecontractattribute.callbackcontract.aspx for more information. 有关更多信息,请参见http://msdn.microsoft.com/en-us/magazine/cc163537.aspx#S2http://msdn.microsoft.com/en-us/library/system.servicemodel.servicecontractattribute.callbackcontract.aspx信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM