Beispiel #1
0
        public override T GetProperty <T>(BindingContext context) where T : class
        {
            if (context == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context");
            }
            if (typeof(T) == typeof(ChannelProtectionRequirements))
            {
                ChannelProtectionRequirements protectionRequirements = this.GetProtectionRequirements(context);
                protectionRequirements.Add(context.GetInnerProperty <ChannelProtectionRequirements>() ?? new ChannelProtectionRequirements());
                return((T)protectionRequirements);
            }
            Collection <BindingElement> collection = context.BindingParameters.FindAll <BindingElement>();
            T individualProperty = default(T);

            for (int i = 0; i < collection.Count; i++)
            {
                individualProperty = collection[i].GetIndividualProperty <T>();
                if (individualProperty != new T())
                {
                    return(individualProperty);
                }
            }
            if (typeof(T) == typeof(MessageVersion))
            {
                return((T)TransportDefaults.GetDefaultMessageEncoderFactory().MessageVersion);
            }
            if (typeof(T) == typeof(XmlDictionaryReaderQuotas))
            {
                return((T) new XmlDictionaryReaderQuotas());
            }
            return(default(T));
        }
        internal MsmqInputSessionChannelListener(MsmqBindingElementBase bindingElement, BindingContext context, MsmqReceiveParameters receiveParameters)
            : base(bindingElement, context, receiveParameters, TransportDefaults.GetDefaultMessageEncoderFactory())
        {
            SetSecurityTokenAuthenticator(MsmqUri.NetMsmqAddressTranslator.Scheme, context);
            this.receiver = new MsmqReceiveHelper(
                this.ReceiveParameters,
                this.Uri,
                new MsmqInputMessagePool((this.ReceiveParameters as MsmqTransportReceiveParameters).MaxPoolSize),
                null,
                this
                );

            if (this.ReceiveParameters.ReceiveContextSettings.Enabled)
            {
                this.receiveContextManager = new MsmqReceiveContextLockManager(this.ReceiveParameters.ReceiveContextSettings, this.receiver.Queue);
            }
        }
        public override T GetProperty <T>(BindingContext context)
        {
            if (context == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context");
            }

            if (typeof(T) == typeof(ChannelProtectionRequirements))
            {
                ChannelProtectionRequirements myRequirements = this.GetProtectionRequirements(context);
                myRequirements.Add(context.GetInnerProperty <ChannelProtectionRequirements>() ?? new ChannelProtectionRequirements());
                return((T)(object)myRequirements);
            }

            // 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)
#pragma warning suppress 56506 // [....], BindingContext.BindingParameters cannot be null
            Collection <BindingElement> bindingElements = context.BindingParameters.FindAll <BindingElement>();

            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);
        }
 protected TransportChannelFactory(TransportBindingElement bindingElement, BindingContext context) : this(bindingElement, context, TransportDefaults.GetDefaultMessageEncoderFactory())
 {
 }
Beispiel #5
0
 protected TransportChannelListener(TransportBindingElement bindingElement, BindingContext context, HostNameComparisonMode hostNameComparisonMode) : this(bindingElement, context, TransportDefaults.GetDefaultMessageEncoderFactory(), hostNameComparisonMode)
 {
 }
Beispiel #6
0
 protected MsmqChannelFactoryBase(MsmqBindingElementBase bindingElement, BindingContext context) :
     this(bindingElement, context, TransportDefaults.GetDefaultMessageEncoderFactory())
 {
 }
Beispiel #7
0
 internal MsmqInputChannelListenerBase(MsmqBindingElementBase bindingElement, BindingContext context, MsmqReceiveParameters receiveParameters) : this(bindingElement, context, receiveParameters, TransportDefaults.GetDefaultMessageEncoderFactory())
 {
 }