开发者

Sharing event with WCF Service

开发者 https://www.devze.com 2023-01-21 19:37 出处:网络
I would like to share the event \'MyEvent\' in the following class: [ServiceContract] public int开发者_如何学Cerface MyInterface

I would like to share the event 'MyEvent' in the following class:

[ServiceContract]    
    public int开发者_如何学Cerface 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?

Thanks in advance!!!


Events are not the way to communicate back to the client in WCF. In WCF you use callbacks. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消