开发者

Can a WCF contract use multiple callback interfaces?

开发者 https://www.devze.com 2022-12-24 02:58 出处:网络
I\'m trying something like this: [ServiceContract ( CallbackContract = typeof (CallbackContract_1), CallbackContract = typeof (Ca开发者_开发问答llbackContract_2),

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

0

精彩评论

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

关注公众号