WebScriptMetadataMessageEncodingBindingElement.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 / NetFx35 / System.ServiceModel.Web / System / ServiceModel / Channels / WebScriptMetadataMessageEncodingBindingElement.cs / 1 / WebScriptMetadataMessageEncodingBindingElement.cs

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

namespace System.ServiceModel.Channels 
{
    using System.ServiceModel; 
    using System.Text; 
    using System.Xml;
 
    sealed class WebScriptMetadataMessageEncodingBindingElement : MessageEncodingBindingElement
    {
        XmlDictionaryReaderQuotas readerQuotas;
 
        public WebScriptMetadataMessageEncodingBindingElement()
        { 
            this.readerQuotas = new XmlDictionaryReaderQuotas(); 
            EncoderDefaults.ReaderQuotas.CopyTo(this.readerQuotas);
        } 

        WebScriptMetadataMessageEncodingBindingElement(WebScriptMetadataMessageEncodingBindingElement elementToBeCloned)
            : base(elementToBeCloned)
        { 
            this.readerQuotas = new XmlDictionaryReaderQuotas();
            elementToBeCloned.readerQuotas.CopyTo(this.readerQuotas); 
        } 

        public override MessageVersion MessageVersion 
        {
            get
            {
                return MessageVersion.None; 
            }
            set 
            { 
                if (value == null)
                { 
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("value");
                }
                if (value != MessageVersion.None)
                { 
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("value", SR2.GetString(SR2.JsonOnlySupportsMessageVersionNone));
                } 
            } 
        }
 
        public XmlDictionaryReaderQuotas ReaderQuotas
        {
            get
            { 
                return this.readerQuotas;
            } 
        } 

        public override IChannelFactory BuildChannelFactory(BindingContext context) 
        {
            return InternalBuildChannelFactory(context);
        }
 
        public override IChannelListener BuildChannelListener(BindingContext context)
        { 
            return InternalBuildChannelListener(context); 
        }
 
        public override bool CanBuildChannelFactory(BindingContext context)
        {
            return InternalCanBuildChannelFactory(context);
        } 

        public override bool CanBuildChannelListener(BindingContext context) 
        { 
            return InternalCanBuildChannelListener(context);
        } 

        public override BindingElement Clone()
        {
            return new WebScriptMetadataMessageEncodingBindingElement(this); 
        }
 
        public override MessageEncoderFactory CreateMessageEncoderFactory() 
        {
            return new WebScriptMetadataMessageEncoderFactory(this.ReaderQuotas); 
        }

        public override T GetProperty(BindingContext context)
        { 
            if (context == null)
            { 
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context"); 
            }
            if (typeof(T) == typeof(XmlDictionaryReaderQuotas)) 
            {
                return (T)(object) this.readerQuotas;
            }
            else 
            {
                return base.GetProperty(context); 
            } 
        }
    } 
}

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