示例#1
0
        public override T GetProperty <T>(BindingContext context)
        {
            if (context == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(context));
            }


            // to cover all our bases, let's iterate through the BindingParameters to make sure
            // we haven't missed a query (since we're the Transport and we're at the bottom)
            Collection <BindingElement> bindingElements = new Collection <BindingElement>();

            foreach (var param in context.BindingParameters)
            {
                if (param is BindingElement)
                {
                    bindingElements.Add((BindingElement)param);
                }
            }

            T result = default(T);

            for (int i = 0; i < bindingElements.Count; i++)
            {
                result = bindingElements[i].GetIndividualProperty <T>();
                if (result != default(T))
                {
                    return(result);
                }
            }

            if (typeof(T) == typeof(MessageVersion))
            {
                return((T)(object)TransportDefaults.GetDefaultMessageEncoderFactory().MessageVersion);
            }

            if (typeof(T) == typeof(XmlDictionaryReaderQuotas))
            {
                return((T)(object)new XmlDictionaryReaderQuotas());
            }

            return(null);
        }
示例#2
0
 protected TransportChannelListener(TransportBindingElement bindingElement, BindingContext context,
                                    HostNameComparisonMode hostNameComparisonMode)
     : this(bindingElement, context, TransportDefaults.GetDefaultMessageEncoderFactory(), hostNameComparisonMode)
 {
 }
示例#3
0
 protected TransportChannelListener(TransportBindingElement bindingElement, BindingContext context)
     : this(bindingElement, context, TransportDefaults.GetDefaultMessageEncoderFactory())
 {
 }