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

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

namespace System.ServiceModel.Configuration 
{
    using System.ComponentModel; 
    using System.Configuration; 
    using System.Globalization;
    using System.ServiceModel.Channels; 
    using System.Text;

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

        public override void ApplyConfiguration(BindingElement bindingElement) 
        {
            base.ApplyConfiguration(bindingElement);
            MtomMessageEncodingBindingElement binding = (MtomMessageEncodingBindingElement)bindingElement;
            binding.MessageVersion = this.MessageVersion; 
            binding.WriteEncoding = this.WriteEncoding;
            binding.MaxReadPoolSize = this.MaxReadPoolSize; 
            binding.MaxWritePoolSize = this.MaxWritePoolSize; 
#pragma warning suppress 56506 //[....]; base.ApplyConfiguration() checks for 'binding' being null
            this.ReaderQuotas.ApplyConfiguration(binding.ReaderQuotas); 
            binding.MaxBufferSize = this.MaxBufferSize;
        }

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

        public override void CopyFrom(ServiceModelExtensionElement from) 
        {
            base.CopyFrom(from);

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

        protected internal override BindingElement CreateBindingElement() 
        {
            MtomMessageEncodingBindingElement binding = new MtomMessageEncodingBindingElement(); 
            this.ApplyConfiguration(binding); 
            return binding;
        } 

        protected internal override void InitializeFrom(BindingElement bindingElement)
        {
            base.InitializeFrom(bindingElement); 
            MtomMessageEncodingBindingElement binding = (MtomMessageEncodingBindingElement)bindingElement;
            this.MessageVersion = binding.MessageVersion; 
            this.WriteEncoding = binding.WriteEncoding; 
            this.MaxReadPoolSize = binding.MaxReadPoolSize;
            this.MaxWritePoolSize = binding.MaxWritePoolSize; 
            this.ReaderQuotas.InitializeFrom(binding.ReaderQuotas);
            this.MaxBufferSize = binding.MaxBufferSize;
        }
 
        [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.MessageVersion, DefaultValue = TextEncoderDefaults.MessageVersionString)]
        [TypeConverter(typeof(MessageVersionConverter))] 
        public MessageVersion MessageVersion
        { 
            get { return (MessageVersion)base[ConfigurationStrings.MessageVersion]; } 
            set { base[ConfigurationStrings.MessageVersion] = value; }
        } 

        [ConfigurationProperty(ConfigurationStrings.ReaderQuotas)]
        public XmlDictionaryReaderQuotasElement ReaderQuotas
        { 
            get { return (XmlDictionaryReaderQuotasElement) base[ConfigurationStrings.ReaderQuotas]; }
        } 
 
        [ConfigurationProperty(ConfigurationStrings.MaxBufferSize, DefaultValue = MtomEncoderDefaults.MaxBufferSize)]
        [IntegerValidator(MinValue = 1)] 
        public int MaxBufferSize
        {
            get { return (int)base[ConfigurationStrings.MaxBufferSize]; }
            set { base[ConfigurationStrings.MaxBufferSize] = value; } 
        }
 
        [ConfigurationProperty(ConfigurationStrings.WriteEncoding, DefaultValue = TextEncoderDefaults.EncodingString)] 
        [TypeConverter(typeof(EncodingConverter))]
        public Encoding WriteEncoding 
        {
            get { return (Encoding)base[ConfigurationStrings.WriteEncoding]; }
            set { base[ConfigurationStrings.WriteEncoding] = value; }
        } 
    }
} 

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