public override IChannelListener <TChannel> BuildChannelListener <TChannel>(BindingContext context)
        {
            if (context == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context");
            }

            PeerChannelListenerBase peerListener = null;
            PeerResolver            peerResolver = GetResolver(context);

            if (typeof(TChannel) == typeof(IInputChannel))
            {
                peerListener = new PeerInputChannelListener(this, context, peerResolver);
            }
            else if (typeof(TChannel) == typeof(IDuplexChannel))
            {
                peerListener = new PeerDuplexChannelListener(this, context, peerResolver);
            }
            else
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("TChannel", SR.GetString(SR.ChannelTypeNotSupported, typeof(TChannel)));
            }

            return((IChannelListener <TChannel>)peerListener);
        }
Ejemplo n.º 2
0
        public override IChannelListener <TChannel> BuildChannelListener <TChannel>(BindingContext context) where TChannel : class, IChannel
        {
            if (context == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context");
            }
            PeerChannelListenerBase base2        = null;
            PeerResolver            peerResolver = this.GetResolver(context);

            if (typeof(TChannel) == typeof(IInputChannel))
            {
                base2 = new PeerInputChannelListener(this, context, peerResolver);
            }
            else
            {
                if (typeof(TChannel) != typeof(IDuplexChannel))
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("TChannel", System.ServiceModel.SR.GetString("ChannelTypeNotSupported", new object[] { typeof(TChannel) }));
                }
                base2 = new PeerDuplexChannelListener(this, context, peerResolver);
            }
            return((IChannelListener <TChannel>)base2);
        }