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

            TransportChannelListener msmqListener;

            MsmqTransportReceiveParameters receiveParameters = new MsmqTransportReceiveParameters(this, MsmqUri.NetMsmqAddressTranslator);

            if (typeof(TChannel) == typeof(IInputChannel))
            {
                msmqListener = new MsmqInputChannelListener(this, context, receiveParameters);
            }
            else if (typeof(TChannel) == typeof(IInputSessionChannel))
            {
                msmqListener = new MsmqInputSessionChannelListener(this, context, receiveParameters);
            }
            else
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("TChannel", SR.GetString(SR.ChannelTypeNotSupported, typeof(TChannel)));
            }
            AspNetEnvironment.Current.ApplyHostedContext(msmqListener, context);

            MsmqVerifier.VerifyReceiver(receiveParameters, msmqListener.Uri);

            return((IChannelListener <TChannel>)(object) msmqListener);
        }
Example #2
0
        public override IChannelListener <TChannel> BuildChannelListener <TChannel>(BindingContext context) where TChannel : class, IChannel
        {
            TransportChannelListener listener;

            if (context == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context");
            }
            MsmqTransportReceiveParameters receiveParameters = new MsmqTransportReceiveParameters(this, MsmqUri.NetMsmqAddressTranslator);

            if (typeof(TChannel) == typeof(IInputChannel))
            {
                listener = new MsmqInputChannelListener(this, context, receiveParameters);
            }
            else
            {
                if (typeof(TChannel) != typeof(IInputSessionChannel))
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("TChannel", System.ServiceModel.SR.GetString("ChannelTypeNotSupported", new object[] { typeof(TChannel) }));
                }
                listener = new MsmqInputSessionChannelListener(this, context, receiveParameters);
            }
            AspNetEnvironment.Current.ApplyHostedContext(listener, context);
            MsmqVerifier.VerifyReceiver(receiveParameters, listener.Uri);
            return((IChannelListener <TChannel>)listener);
        }
Example #3
0
        public override IChannelFactory <TChannel> BuildChannelFactory <TChannel>(BindingContext context)
        {
            if (context == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context");
            }
            if (typeof(TChannel) == typeof(IOutputChannel))
            {
                MsmqChannelFactoryBase <IOutputChannel> base2 = new MsmqOutputChannelFactory(this, context);
                MsmqVerifier.VerifySender <IOutputChannel>(base2);
                return((IChannelFactory <TChannel>)base2);
            }
            if (typeof(TChannel) != typeof(IOutputSessionChannel))
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("TChannel", System.ServiceModel.SR.GetString("ChannelTypeNotSupported", new object[] { typeof(TChannel) }));
            }
            MsmqChannelFactoryBase <IOutputSessionChannel> factory = new MsmqOutputSessionChannelFactory(this, context);

            MsmqVerifier.VerifySender <IOutputSessionChannel>(factory);
            return((IChannelFactory <TChannel>)factory);
        }
Example #4
0
        public override IChannelFactory <TChannel> BuildChannelFactory <TChannel>(BindingContext context)
        {
            if (context == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context");
            }

            if (typeof(TChannel) == typeof(IOutputChannel))
            {
                MsmqChannelFactoryBase <IOutputChannel> factory = new MsmqOutputChannelFactory(this, context);
                MsmqVerifier.VerifySender <IOutputChannel>(factory);
                return((IChannelFactory <TChannel>)(object) factory);
            }
            else if (typeof(TChannel) == typeof(IOutputSessionChannel))
            {
                MsmqChannelFactoryBase <IOutputSessionChannel> factory = new MsmqOutputSessionChannelFactory(this, context);
                MsmqVerifier.VerifySender <IOutputSessionChannel>(factory);
                return((IChannelFactory <TChannel>)(object) factory);
            }
            else
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("TChannel", SR.GetString(SR.ChannelTypeNotSupported, typeof(TChannel)));
            }
        }