tags:

views:

145

answers:

1

I have a nettcp WCF service that supports single callback method.

I want to add new callback methods by adding new interface that contains the new methods without breaking the old one as there is another things depend on the old interface.

I tried to add new interface that inherits from the old one but the gerenated proxy in the the client application does not contain the old callback interface.

the code is as follows

interface IOldCallback
    {
        [OperationContract(IsOneWay = true)]
        void OnMethod1(int x);
    }

interface INewCallback : IOldCallback
{
[OperationContract(IsOneWay = true)]
        void OnMethod2(float x);

[OperationContract(IsOneWay = true)]
        void OnMethod3(bool x);


}
 [ServiceContract(SessionMode = SessionMode.Required, CallbackContract = typeof(INewCallback))]
    public interface IMyService
{
}

P.S

I make quick and dirty solution so I'll not break the old client codes

interface INewCallback : IOldCallback
{
[OperationContract(IsOneWay = true)]
        void OnMethod2(float x);

[OperationContract(IsOneWay = true)]
        void OnMethod3(bool x);

[OperationContract(IsOneWay = true)]
       new void OnMethod1(int x);


}
+1  A: 

You cannot do this - you can have at most one callback.

What you could look into is a publish-and-subscribe service, where your source would send out a message that is then routed to anyone that is subscribed to it. This would require additional bits and pieces, e.g. something like NServiceBus for local scenarios, or something like the .NET Service Bus for a more internet-oriented solution "in the cloud".

Marc

marc_s