コード例 #1
0
        public override bool CanBuildChannelFactory <TChannel>(BindingContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            MessageVersion message = context.GetInnerProperty <MessageVersion>();

            if (message.Addressing == AddressingVersion.None)
            {
                return(false);
            }

            if (typeof(TChannel) == typeof(IDuplexChannel))
            {
                return(context.CanBuildInnerChannelFactory <IRequestChannel>());
            }

            if (typeof(TChannel) == typeof(IDuplexSessionChannel))
            {
                return(context.CanBuildInnerChannelFactory <IRequestSessionChannel>());
            }

            return(false);
        }
コード例 #2
0
 public override bool CanBuildChannelFactory <TChannel>(BindingContext context)
 {
     VerifyEncodingMessageVersion(context);
     if (typeof(IOutputChannel) == typeof(TChannel))
     {
         return(context.CanBuildInnerChannelFactory <IRequestChannel>());
     }
     else
     {
         return(context.CanBuildInnerChannelFactory <TChannel>());
     }
 }
コード例 #3
0
 public override bool CanBuildChannelFactory <TChannel>(BindingContext context)
 {
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     return(context.CanBuildInnerChannelFactory <TChannel>());
 }
コード例 #4
0
        public override bool CanBuildChannelFactory <TChannel>(BindingContext context)
        {
            if (context == null)
            {
                throw new ArgumentException("context", "Context cannot be null, please pass a BindingContext!");
            }

            return(context.CanBuildInnerChannelFactory <TChannel>());
        }
コード例 #5
0
        public override bool CanBuildChannelFactory <TChannel>(BindingContext context)
        {
            if (context == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(context));
            }

            return(context.CanBuildInnerChannelFactory <TChannel>());
        }
コード例 #6
0
ファイル: program.cs プロジェクト: zhimaqiao51/docs
        void Snippet11()
        {
            // <Snippet11>
            CustomBinding binding              = new CustomBinding();
            BindingParameterCollection bpCol   = new BindingParameterCollection();
            BindingContext             context = new BindingContext(binding, bpCol);

            context.CanBuildInnerChannelFactory <IDuplexChannel>();
            // </Snippet11>
        }
コード例 #7
0
        public override bool CanBuildChannelFactory <TChannel>(BindingContext context)
        {
            Utility.IfNullThrowNullArgumentException(context, "context");
            if (typeof(TChannel) == typeof(IDuplexChannel))
            {
                return(context.CanBuildInnerChannelFactory <TChannel>());
            }

            return(false);
        }
コード例 #8
0
        internal bool InternalCanBuildChannelFactory <TChannel>(BindingContext context)
        {
            if (context == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("context"));
            }

            context.BindingParameters.Add(this);
            return(context.CanBuildInnerChannelFactory <TChannel>());
        }
 public override bool CanBuildChannelFactory <TChannel>(BindingContext context)
 {
     if (context == null)
     {
         throw new ArgumentNullException(nameof(context));
     }
     if (IsSupportedChannelShape(typeof(TChannel)))
     {
         return(context.CanBuildInnerChannelFactory <TChannel>());
     }
     return(false);
 }
コード例 #10
0
        /// <summary>
        /// Used by the higher layers to determine what types of channel factories this
        /// binding element supports.
        /// </summary>
        public override bool CanBuildChannelFactory <TChannel>(BindingContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            if (IsBindingHttp(context.Binding) &&
                typeof(TChannel) == typeof(IRequestSessionChannel) &&
                context.CanBuildInnerChannelFactory <IRequestChannel>())
            {
                return(true);
            }

            return(false);
        }
コード例 #11
0
        public override bool CanBuildChannelFactory <TChannel>(BindingContext context)
        {
            if (context == null)
            {
                throw FxTrace.Exception.ArgumentNull("context");
            }

            if (typeof(TChannel) == typeof(IOutputChannel) ||
                typeof(TChannel) == typeof(IDuplexChannel) ||
                typeof(TChannel) == typeof(IRequestChannel) ||
                typeof(TChannel) == typeof(IOutputSessionChannel) ||
                typeof(TChannel) == typeof(IRequestSessionChannel) ||
                typeof(TChannel) == typeof(IDuplexSessionChannel))
            {
                return(context.CanBuildInnerChannelFactory <TChannel>());
            }

            return(false);
        }
コード例 #12
0
        public override IChannelFactory <TChannel> BuildChannelFactory <TChannel>(BindingContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            ThrowIfNotHttpTransport(context.Binding);

            if (typeof(TChannel) != typeof(IRequestSessionChannel))
            {
                throw new ArgumentException("HttpCookieSessionBindingElement only supports IRequestSessionChannel Factories.", "TChannel");
            }

            if (!context.CanBuildInnerChannelFactory <IRequestChannel>())
            {
                throw new InvalidOperationException(
                          "HttpCookieSessionBindingElement must be stacked on top of a channel that supports IRequestChannel.");
            }

            return((IChannelFactory <TChannel>)(object) new HttpCookieSessionChannelFactory(this, context));
        }
コード例 #13
0
 public override bool CanBuildChannelFactory <TChannel>(BindingContext context)
 {
     context.BindingParameters.Add(this);
     return(context.CanBuildInnerChannelFactory <TChannel>());
 }
コード例 #14
0
 public override bool CanBuildChannelFactory <T> (BindingContext ctx)
 {
     return(ctx.CanBuildInnerChannelFactory <T> ());
 }
コード例 #15
0
 public override bool CanBuildChannelFactory <TChannel>(BindingContext context)
 {
     // Return true if it is a request channel and the rest of the call stack supports this type of channel.
     return(typeof(TChannel) == typeof(IRequestChannel) && context.CanBuildInnerChannelFactory <TChannel>());
 }
コード例 #16
0
 public override bool CanBuildChannelFactory <TChannel>(
     BindingContext context)
 {
     ValidateTransport(context.Binding);
     return(context.CanBuildInnerChannelFactory <TChannel>());
 }
コード例 #17
0
 public override bool CanBuildChannelFactory <TChannel>(BindingContext context)
 {
     return(context.CanBuildInnerChannelFactory <TChannel>());
 }
コード例 #18
0
 public override bool CanBuildChannelFactory <TChannel>(BindingContext context)
 {
     return(typeof(TChannel) == typeof(IDuplexSessionChannel) && context.CanBuildInnerChannelFactory <TChannel>());
 }