//------------------------------------------------------------ // 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); } } } }