Example #1
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 #2
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)));
            }
        }