Can a WCF contract use multiple callback interfaces?
I'm trying something like this:
[ServiceContract (
CallbackContract = typeof (CallbackContract_1),
CallbackContract = typeof (Ca开发者_开发问答llbackContract_2),
CallbackContract = typeof (CallbackContract_3))
]
public interface SomeWcfContract {
I know it does not work like this. Is there still a way to get a single contract use multiple callback interfaces?
A service contract can only designate a callback contract if that contract is a subinterface of all callback contracts defined by the contract's own base contracts.
interface ICallbackContract1
{...}
interface ICallbackContract2 : ICallbackContract1
{...}
[ServiceContract(CallbackContract = typeof(ICallbackContract1))]
interface IMyBaseContract
{...}
[ServiceContract(CallbackContract = typeof(ICallbackContract2))]
interface IMySubContract : IMyBaseContract
{...}
or
interface ICallbackContract1
{...}
interface ICallbackContract2
{...}
interface ICallbackContract3 : ICallbackContract2,ICallbackContract1
{...}
[ServiceContract(CallbackContract = typeof(ICallbackContract1))]
interface IMyBaseContract1
{...}
[ServiceContract(CallbackContract = typeof(ICallbackContract2))]
interface IMyBaseContract2
{...}
[ServiceContract(CallbackContract = typeof(ICallbackContract3))]
interface IMySubContract : IMyBaseContract1,IMyBaseContract2
{...}
see for more details
精彩评论