WSHttpBindingBaseElement.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Configuration / WSHttpBindingBaseElement.cs / 1 / WSHttpBindingBaseElement.cs

                            //------------------------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------------------------

namespace System.ServiceModel.Configuration 
{
    using System.Configuration; 
    using System.ServiceModel; 
    using System.Globalization;
    using System.ServiceModel.Security; 
    using System.ComponentModel;
    using System.Text;
    using System.ServiceModel.Channels;
 
    public abstract partial class WSHttpBindingBaseElement : StandardBindingElement
    { 
        protected WSHttpBindingBaseElement(string name) 
            : base(name)
        { 
        }

        protected WSHttpBindingBaseElement()
            : this(null) 
        {
        } 
 
        [ConfigurationProperty(ConfigurationStrings.BypassProxyOnLocal, DefaultValue = HttpTransportDefaults.BypassProxyOnLocal)]
        public bool BypassProxyOnLocal 
        {
            get {return (bool) base[ConfigurationStrings.BypassProxyOnLocal]; }
            set {base[ConfigurationStrings.BypassProxyOnLocal] = value; }
        } 

        [ConfigurationProperty(ConfigurationStrings.TransactionFlow, DefaultValue = TransactionFlowDefaults.Transactions)] 
        public bool TransactionFlow 
        {
            get { return (bool)base[ConfigurationStrings.TransactionFlow]; } 
            set { base[ConfigurationStrings.TransactionFlow] = value; }
        }

        [ConfigurationProperty(ConfigurationStrings.HostNameComparisonMode, DefaultValue = HttpTransportDefaults.HostNameComparisonMode)] 
        [ServiceModelEnumValidator(typeof(HostNameComparisonModeHelper))]
        public HostNameComparisonMode HostNameComparisonMode 
        { 
            get {return (HostNameComparisonMode) base[ConfigurationStrings.HostNameComparisonMode]; }
            set {base[ConfigurationStrings.HostNameComparisonMode] = value; } 
        }

        [ConfigurationProperty(ConfigurationStrings.MaxBufferPoolSize, DefaultValue = TransportDefaults.MaxBufferPoolSize)]
        [LongValidator(MinValue = 0)] 
        public long MaxBufferPoolSize
        { 
            get {return (long) base[ConfigurationStrings.MaxBufferPoolSize]; } 
            set {base[ConfigurationStrings.MaxBufferPoolSize] = value; }
        } 

        [ConfigurationProperty(ConfigurationStrings.MaxReceivedMessageSize, DefaultValue = TransportDefaults.MaxReceivedMessageSize)]
        [LongValidator(MinValue = 1)]
        public long MaxReceivedMessageSize 
        {
            get { return (long)base[ConfigurationStrings.MaxReceivedMessageSize]; } 
            set { base[ConfigurationStrings.MaxReceivedMessageSize] = value; } 
        }
 
        [ConfigurationProperty(ConfigurationStrings.MessageEncoding, DefaultValue = WSHttpBindingDefaults.MessageEncoding)]
        [ServiceModelEnumValidator(typeof(WSMessageEncodingHelper))]
        public WSMessageEncoding MessageEncoding
        { 
            get {return (WSMessageEncoding) base[ConfigurationStrings.MessageEncoding]; }
            set {base[ConfigurationStrings.MessageEncoding] = value; } 
        } 

        [ConfigurationProperty(ConfigurationStrings.ProxyAddress, DefaultValue = HttpTransportDefaults.ProxyAddress)] 
        public Uri ProxyAddress
        {
            get {return (Uri) base[ConfigurationStrings.ProxyAddress]; }
            set {base[ConfigurationStrings.ProxyAddress] = value; } 
        }
 
        [ConfigurationProperty(ConfigurationStrings.ReaderQuotas)] 
        public XmlDictionaryReaderQuotasElement ReaderQuotas
        { 
            get { return (XmlDictionaryReaderQuotasElement) base[ConfigurationStrings.ReaderQuotas]; }
        }

        [ConfigurationProperty(ConfigurationStrings.ReliableSession)] 
        public StandardBindingOptionalReliableSessionElement ReliableSession
        { 
            get {return (StandardBindingOptionalReliableSessionElement) base[ConfigurationStrings.ReliableSession]; } 
        }
 
        [ConfigurationProperty(ConfigurationStrings.TextEncoding, DefaultValue = TextEncoderDefaults.EncodingString)]
        [TypeConverter(typeof(EncodingConverter))]
        public Encoding TextEncoding
        { 
            get {return (Encoding) base[ConfigurationStrings.TextEncoding]; }
            set {base[ConfigurationStrings.TextEncoding] = value; } 
        } 

        [ConfigurationProperty(ConfigurationStrings.UseDefaultWebProxy, DefaultValue = HttpTransportDefaults.UseDefaultWebProxy)] 
        public bool UseDefaultWebProxy
        {
            get { return (bool)base[ConfigurationStrings.UseDefaultWebProxy]; }
            set { base[ConfigurationStrings.UseDefaultWebProxy] = value; } 
        }
 
        protected internal override void InitializeFrom(Binding binding) 
        {
            base.InitializeFrom(binding); 
            WSHttpBindingBase wspBinding = (WSHttpBindingBase)binding;

            this.BypassProxyOnLocal = wspBinding.BypassProxyOnLocal;
            this.TransactionFlow = wspBinding.TransactionFlow; 
            this.HostNameComparisonMode = wspBinding.HostNameComparisonMode;
            this.MaxBufferPoolSize = wspBinding.MaxBufferPoolSize; 
            this.MaxReceivedMessageSize = wspBinding.MaxReceivedMessageSize; 
            this.MessageEncoding = wspBinding.MessageEncoding;
            if (wspBinding.ProxyAddress != null) 
                this.ProxyAddress = wspBinding.ProxyAddress;
            this.TextEncoding = wspBinding.TextEncoding;
            this.UseDefaultWebProxy = wspBinding.UseDefaultWebProxy;
            this.ReaderQuotas.InitializeFrom(wspBinding.ReaderQuotas); 
            this.ReliableSession.InitializeFrom(wspBinding.ReliableSession);
        } 
 
        protected override void OnApplyConfiguration(Binding binding)
        { 
            WSHttpBindingBase wspBinding = (WSHttpBindingBase) binding;

            wspBinding.BypassProxyOnLocal = this.BypassProxyOnLocal;
            wspBinding.TransactionFlow = this.TransactionFlow; 
            wspBinding.HostNameComparisonMode = this.HostNameComparisonMode;
            wspBinding.MaxBufferPoolSize = this.MaxBufferPoolSize; 
            wspBinding.MaxReceivedMessageSize = this.MaxReceivedMessageSize; 
            wspBinding.MessageEncoding = this.MessageEncoding;
            if (this.ProxyAddress != null) 
                wspBinding.ProxyAddress = this.ProxyAddress;
            wspBinding.TextEncoding = this.TextEncoding;
            wspBinding.UseDefaultWebProxy = this.UseDefaultWebProxy;
            this.ReaderQuotas.ApplyConfiguration(wspBinding.ReaderQuotas); 
            this.ReliableSession.ApplyConfiguration(wspBinding.ReliableSession);
        } 
    } 

} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK