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

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

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

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

        public override void ApplyConfiguration(BindingElement bindingElement) 
        {
            base.ApplyConfiguration(bindingElement);
            TextMessageEncodingBindingElement binding = (TextMessageEncodingBindingElement)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); 
        }

        public override Type BindingElementType
        { 
            get { return typeof(TextMessageEncodingBindingElement); }
        } 
 
        public override void CopyFrom(ServiceModelExtensionElement from)
        { 
            base.CopyFrom(from);

            TextMessageEncodingElement source = (TextMessageEncodingElement)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;
        } 

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

        protected internal override void InitializeFrom(BindingElement bindingElement) 
        {
            base.InitializeFrom(bindingElement);
            TextMessageEncodingBindingElement binding = (TextMessageEncodingBindingElement)bindingElement;
            this.MessageVersion = binding.MessageVersion; 
            this.WriteEncoding = binding.WriteEncoding;
            this.MaxReadPoolSize = binding.MaxReadPoolSize; 
            this.MaxWritePoolSize = binding.MaxWritePoolSize; 
            this.ReaderQuotas.InitializeFrom(binding.ReaderQuotas);
        } 

        [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.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