NetNamedPipeBindingElement.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 / NetNamedPipeBindingElement.cs / 1 / NetNamedPipeBindingElement.cs

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

namespace System.ServiceModel.Configuration 
{
    using System.ComponentModel; 
    using System.Configuration; 
    using System.ServiceModel;
    using System.Globalization; 
    using System.ServiceModel.Security;
    using System.ServiceModel.Channels;
    using System.Net.Security;
 
    public partial class NetNamedPipeBindingElement : StandardBindingElement
    { 
        public NetNamedPipeBindingElement(string name) 
            : base(name)
        { 
        }

        public NetNamedPipeBindingElement()
            : this(null) 
        {
        } 
 
        protected override Type BindingElementType
        { 
            get { return typeof(NetNamedPipeBinding); }
        }

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

        [ConfigurationProperty(ConfigurationStrings.TransferMode, DefaultValue = ConnectionOrientedTransportDefaults.TransferMode)]
        [ServiceModelEnumValidator(typeof(TransferModeHelper))]
        public TransferMode TransferMode 
        {
            get { return (TransferMode)base[ConfigurationStrings.TransferMode]; } 
            set { base[ConfigurationStrings.TransferMode] = value; } 
        }
 
        [ConfigurationProperty(ConfigurationStrings.TransactionProtocol, DefaultValue = TransactionFlowDefaults.TransactionProtocolString)]
        [TypeConverter(typeof(TransactionProtocolConverter))]
        public TransactionProtocol TransactionProtocol
        { 
            get { return (TransactionProtocol)base[ConfigurationStrings.TransactionProtocol]; }
            set { base[ConfigurationStrings.TransactionProtocol] = value; } 
        } 

        [ConfigurationProperty(ConfigurationStrings.HostNameComparisonMode, DefaultValue = ConnectionOrientedTransportDefaults.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.MaxBufferSize, DefaultValue = TransportDefaults.MaxBufferSize)] 
        [IntegerValidator(MinValue = 1)]
        public int MaxBufferSize 
        {
            get {return (int) base[ConfigurationStrings.MaxBufferSize]; }
            set {base[ConfigurationStrings.MaxBufferSize] = value; }
        } 

        [ConfigurationProperty(ConfigurationStrings.MaxConnections, DefaultValue = ConnectionOrientedTransportDefaults.MaxPendingConnections)] 
        [IntegerValidator(MinValue = 1)] 
        public int MaxConnections
        { 
            get {return (int) base[ConfigurationStrings.MaxConnections]; }
            set {base[ConfigurationStrings.MaxConnections] = 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.ReaderQuotas)] 
        public XmlDictionaryReaderQuotasElement ReaderQuotas
        { 
            get { return (XmlDictionaryReaderQuotasElement) base[ConfigurationStrings.ReaderQuotas]; } 
        }
 
        [ConfigurationProperty(ConfigurationStrings.Security)]
        public NetNamedPipeSecurityElement Security
        {
            get { return (NetNamedPipeSecurityElement)base[ConfigurationStrings.Security]; } 
        }
 
        protected internal override void InitializeFrom(Binding binding) 
        {
            base.InitializeFrom(binding); 
            NetNamedPipeBinding npnpBinding = (NetNamedPipeBinding) binding;

            this.TransactionFlow = npnpBinding.TransactionFlow;
            this.TransferMode = npnpBinding.TransferMode; 
            this.TransactionProtocol = npnpBinding.TransactionProtocol;
            this.HostNameComparisonMode = npnpBinding.HostNameComparisonMode; 
            this.MaxBufferPoolSize = npnpBinding.MaxBufferPoolSize; 
            this.MaxBufferSize = npnpBinding.MaxBufferSize;
            this.MaxConnections = npnpBinding.MaxConnections; 
            this.MaxReceivedMessageSize = npnpBinding.MaxReceivedMessageSize;
            this.Security.InitializeFrom(npnpBinding.Security);
            this.ReaderQuotas.InitializeFrom(npnpBinding.ReaderQuotas);
        } 

        protected override void OnApplyConfiguration(Binding binding) 
        { 
            NetNamedPipeBinding npnpBinding = (NetNamedPipeBinding) binding;
 
            npnpBinding.TransactionFlow = this.TransactionFlow;
            npnpBinding.TransferMode = this.TransferMode;
            npnpBinding.TransactionProtocol = this.TransactionProtocol;
            npnpBinding.HostNameComparisonMode = this.HostNameComparisonMode; 
            npnpBinding.MaxBufferPoolSize = this.MaxBufferPoolSize;
            PropertyInformationCollection propertyInfo = this.ElementInformation.Properties; 
            if (propertyInfo[ConfigurationStrings.MaxBufferSize].ValueOrigin != PropertyValueOrigin.Default) 
            {
                npnpBinding.MaxBufferSize = this.MaxBufferSize; 
            }
            npnpBinding.MaxConnections = this.MaxConnections;
            npnpBinding.MaxReceivedMessageSize = this.MaxReceivedMessageSize;
            this.Security.ApplyConfiguration(npnpBinding.Security); 
            this.ReaderQuotas.ApplyConfiguration(npnpBinding.ReaderQuotas);
        } 
    } 
}

// 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