0

I am trying to extend a ServiceContract with a callback contract attribute. IProcessSubDataDuplex is generated by a code generator so I need to extend that to integrate CallbackContract attribute. But IProcessDataDuplex does not implement any of the ServiceContract attributes. Is there a workaround for this?

    [ServiceContract(CallbackContract = typeof(IProcessDataDuplexCallBack))]
    public interface IProcessDataDuplex : IProcessSubDataDuplex
    {

    }

    [ServiceContract(Namespace = "http://www.example.com/", Name = "BeaconMonitorServiceContract", ProtectionLevel = ProtectionLevel.Sign)]
    public interface IProcessSubDataDuplex
    {
        [OperationContract(IsOneWay = true)]
        void ProcessData(string rawData);
    }
pats
  • 1,273
  • 2
  • 20
  • 43
  • I am not able to understand the issue. Can you elaborate? Please [check this](http://stackoverflow.com/questions/1044174/what-steps-do-i-need-to-take-to-use-wcf-callbacks). It might help. – Bharat Gupta Mar 03 '16 at 04:50
  • The issue is IProcessDataDuplex does not inherit IProcessSubDataDuplex ServiceContract attributes. e.g. ProtectionLevel. Issue is not related to client side. How can I extend the ServiceContract interface with attributes – pats Mar 03 '16 at 04:51
  • 1
    I think that is not possible. The purpose of an attribute is to decorate a class not to change the meaning of it (by extending). – Bharat Gupta Mar 03 '16 at 05:00
  • @pats what are you trying to achieve? – Abhinav Galodha Mar 03 '16 at 05:14
  • IProcessSubDataDuplex is created by a code generator. So I cant change that class. But code generator cannot create CallbackContract attribute. So I need to extend IProcessSubDataDuplex to specify CallbackContract as an attribute without copying [ServiceContract] of IProcessSubDataDuplex in the extended interface. – pats Mar 03 '16 at 06:10
  • *IProcessSubDataDuplex is created by a code generator. So I cant change that class* - this is the cause of your problem. – tom redfern Mar 03 '16 at 09:15

0 Answers0