예제 #1
0
        public override IChannelFactory <TChannel> BuildChannelFactory <TChannel>(BindingContext context)
        {
            if (context == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context");
            }

            if (!this.CanBuildChannelFactory <TChannel>(context))
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(
                          "TChannel", SR.GetString(SR.ChannelTypeNotSupported, typeof(TChannel)));
            }

            IChannelFactory <IOutputChannel> innerChannelFactory = context.Clone().BuildInnerChannelFactory <IOutputChannel>();

            if (this.clientChannelDemuxer == null)
            {
                this.clientChannelDemuxer = new InputChannelDemuxer(context);
            }
            else
            {
#pragma warning suppress 56506 // Microsoft, context.RemainingBindingElements will never be null
                context.RemainingBindingElements.Clear();
            }
            LocalAddressProvider localAddressProvider = context.BindingParameters.Remove <LocalAddressProvider>();
            return((IChannelFactory <TChannel>)(object)
                   new InternalDuplexChannelFactory(this, context, this.clientChannelDemuxer, innerChannelFactory, localAddressProvider));
        }
예제 #2
0
        internal InternalDuplexChannelFactory(InternalDuplexBindingElement bindingElement, BindingContext context, InputChannelDemuxer channelDemuxer, IChannelFactory <IOutputChannel> innerChannelFactory, LocalAddressProvider localAddressProvider) : base(context.Binding, innerChannelFactory)
        {
            this.channelDemuxer      = channelDemuxer;
            this.innerChannelFactory = innerChannelFactory;
            ChannelDemuxerFilter filter = new ChannelDemuxerFilter(new MatchNoneMessageFilter(), -2147483648);

            this.innerChannelListener = this.channelDemuxer.BuildChannelListener <IInputChannel>(filter);
            this.localAddressProvider = localAddressProvider;
            this.providesCorrelation  = bindingElement.ProvidesCorrelation;
        }
예제 #3
0
        public override IChannelFactory <TChannel> BuildChannelFactory <TChannel>(BindingContext context)
        {
            if (context == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context");
            }
            if (!this.CanBuildChannelFactory <TChannel>(context))
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("TChannel", System.ServiceModel.SR.GetString("ChannelTypeNotSupported", new object[] { typeof(TChannel) }));
            }
            IChannelFactory <IOutputChannel> innerChannelFactory = context.Clone().BuildInnerChannelFactory <IOutputChannel>();

            if (this.clientChannelDemuxer == null)
            {
                this.clientChannelDemuxer = new InputChannelDemuxer(context);
            }
            else
            {
                context.RemainingBindingElements.Clear();
            }
            LocalAddressProvider localAddressProvider = context.BindingParameters.Remove <LocalAddressProvider>();

            return((IChannelFactory <TChannel>) new InternalDuplexChannelFactory(this, context, this.clientChannelDemuxer, innerChannelFactory, localAddressProvider));
        }