BuildChannelFactory <TChannel> (
     BindingContext context)
 {
     return(context.BuildInnerChannelFactory <TChannel> ());
 }
        public override IChannelFactory <TChannel> BuildChannelFactory <TChannel>(BindingContext context)
        {
            if (context == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context");
            }

            this.VerifyTransportMode(context);
            this.SetSecuritySettings(context);

            InternalDuplexBindingElement.AddDuplexFactorySupport(context, ref this.internalDuplexBindingElement);

            if (typeof(TChannel) == typeof(IOutputSessionChannel))
            {
                if (context.CanBuildInnerChannelFactory <IRequestSessionChannel>())
                {
                    return((IChannelFactory <TChannel>)(object)
                           new ReliableChannelFactory <TChannel, IRequestSessionChannel>(
                               this, context.BuildInnerChannelFactory <IRequestSessionChannel>(), context.Binding));
                }
                else if (context.CanBuildInnerChannelFactory <IRequestChannel>())
                {
                    return((IChannelFactory <TChannel>)(object)
                           new ReliableChannelFactory <TChannel, IRequestChannel>(
                               this, context.BuildInnerChannelFactory <IRequestChannel>(), context.Binding));
                }
                else if (context.CanBuildInnerChannelFactory <IDuplexSessionChannel>())
                {
                    return((IChannelFactory <TChannel>)(object)
                           new ReliableChannelFactory <TChannel, IDuplexSessionChannel>(
                               this, context.BuildInnerChannelFactory <IDuplexSessionChannel>(), context.Binding));
                }
                else if (context.CanBuildInnerChannelFactory <IDuplexChannel>())
                {
                    return((IChannelFactory <TChannel>)(object)
                           new ReliableChannelFactory <TChannel, IDuplexChannel>(
                               this, context.BuildInnerChannelFactory <IDuplexChannel>(), context.Binding));
                }
            }
            else if (typeof(TChannel) == typeof(IDuplexSessionChannel))
            {
                if (context.CanBuildInnerChannelFactory <IDuplexSessionChannel>())
                {
                    return((IChannelFactory <TChannel>)(object)
                           new ReliableChannelFactory <TChannel, IDuplexSessionChannel>(
                               this, context.BuildInnerChannelFactory <IDuplexSessionChannel>(), context.Binding));
                }
                else if (context.CanBuildInnerChannelFactory <IDuplexChannel>())
                {
                    return((IChannelFactory <TChannel>)(object)
                           new ReliableChannelFactory <TChannel, IDuplexChannel>(
                               this, context.BuildInnerChannelFactory <IDuplexChannel>(), context.Binding));
                }
            }
            else if (typeof(TChannel) == typeof(IRequestSessionChannel))
            {
                if (context.CanBuildInnerChannelFactory <IRequestSessionChannel>())
                {
                    return((IChannelFactory <TChannel>)(object)
                           new ReliableChannelFactory <TChannel, IRequestSessionChannel>(
                               this, context.BuildInnerChannelFactory <IRequestSessionChannel>(), context.Binding));
                }
                else if (context.CanBuildInnerChannelFactory <IRequestChannel>())
                {
                    return((IChannelFactory <TChannel>)(object)
                           new ReliableChannelFactory <TChannel, IRequestChannel>(
                               this, context.BuildInnerChannelFactory <IRequestChannel>(), context.Binding));
                }
            }

            throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("TChannel", SR.GetString(SR.ChannelTypeNotSupported, typeof(TChannel)));
        }
 public ContextChannelFactory(BindingContext context, ContextExchangeMechanism contextExchangeMechanism, Uri callbackAddress, bool contextManagementEnabled) : base((context == null) ? null : context.Binding, (context == null) ? null : context.BuildInnerChannelFactory <TChannel>())
 {
     if (!ContextExchangeMechanismHelper.IsDefined(contextExchangeMechanism))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("contextExchangeMechanism"));
     }
     this.contextExchangeMechanism = contextExchangeMechanism;
     this.callbackAddress          = callbackAddress;
     this.contextManagementEnabled = contextManagementEnabled;
 }
 public DuplexOneWayChannelFactory(OneWayBindingElement bindingElement, BindingContext context)
     : base(context.Binding, context.BuildInnerChannelFactory <IDuplexChannel>())
 {
     this.innnerFactory  = (IChannelFactory <IDuplexChannel>) this.InnerChannelFactory;
     this.packetRoutable = bindingElement.PacketRoutable;
 }