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

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

namespace System.ServiceModel.Configuration 
{
    using System.Configuration; 
    using System.ServiceModel.Channels; 

    public sealed partial class BinaryMessageEncodingElement : BindingElementExtensionElement 
    {
        public BinaryMessageEncodingElement()
        {
        } 

        public override Type BindingElementType 
        { 
            get { return typeof(BinaryMessageEncodingBindingElement); }
        } 

        [ConfigurationProperty(ConfigurationStrings.MaxReadPoolSize, DefaultValue = EncoderDefaults.MaxReadPoolSize)]
        [IntegerValidator(MinValue = 1)]
        public int MaxReadPoolSize 
        {
            get { return (int)base[ConfigurationStrings.MaxReadPoolSize]; } 
            set { base[ConfigurationStrings.MaxReadPoolSize] = value; } 
        }
 
        [ConfigurationProperty(ConfigurationStrings.MaxWritePoolSize, DefaultValue = EncoderDefaults.MaxWritePoolSize)]
        [IntegerValidator(MinValue = 1)]
        public int MaxWritePoolSize
        { 
            get { return (int)base[ConfigurationStrings.MaxWritePoolSize]; }
            set { base[ConfigurationStrings.MaxWritePoolSize] = value; } 
        } 

        [ConfigurationProperty(ConfigurationStrings.MaxSessionSize, DefaultValue = BinaryEncoderDefaults.MaxSessionSize)] 
        [IntegerValidator(MinValue = 0)]
        public int MaxSessionSize
        {
            get { return (int)base[ConfigurationStrings.MaxSessionSize]; } 
            set { base[ConfigurationStrings.MaxSessionSize] = value; }
        } 
 
        [ConfigurationProperty(ConfigurationStrings.ReaderQuotas)]
        public XmlDictionaryReaderQuotasElement ReaderQuotas 
        {
            get { return (XmlDictionaryReaderQuotasElement) base[ConfigurationStrings.ReaderQuotas]; }
        }
 
        public override void ApplyConfiguration(BindingElement bindingElement)
        { 
            base.ApplyConfiguration(bindingElement); 
            BinaryMessageEncodingBindingElement binding = (BinaryMessageEncodingBindingElement)bindingElement;
            binding.MaxSessionSize = this.MaxSessionSize; 
            binding.MaxReadPoolSize = this.MaxReadPoolSize;
            binding.MaxWritePoolSize = this.MaxWritePoolSize;
#pragma warning suppress 56506 //[....]; base.ApplyConfiguration() checks for 'binding' being null
            this.ReaderQuotas.ApplyConfiguration(binding.ReaderQuotas); 
        }
 
        public override void CopyFrom(ServiceModelExtensionElement from) 
        {
            base.CopyFrom(from); 

            BinaryMessageEncodingElement source = (BinaryMessageEncodingElement)from;
#pragma warning suppress 56506 //[....]; base.CopyFrom() checks for 'from' being null
            this.MaxSessionSize = source.MaxSessionSize; 
            this.MaxReadPoolSize = source.MaxReadPoolSize;
            this.MaxWritePoolSize = source.MaxWritePoolSize; 
        } 

        protected internal override void InitializeFrom(BindingElement bindingElement) 
        {
            base.InitializeFrom(bindingElement);
            BinaryMessageEncodingBindingElement binding = (BinaryMessageEncodingBindingElement)bindingElement;
            this.MaxSessionSize = binding.MaxSessionSize; 
            this.MaxReadPoolSize = binding.MaxReadPoolSize;
            this.MaxWritePoolSize = binding.MaxWritePoolSize; 
            this.ReaderQuotas.InitializeFrom(binding.ReaderQuotas); 
        }
 
        protected internal override BindingElement CreateBindingElement()
        {
            BinaryMessageEncodingBindingElement binding = new BinaryMessageEncodingBindingElement();
            this.ApplyConfiguration(binding); 
            return binding;
        } 
    } 
}
 

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