Files
dotnet-bot adf899c629 Adding System.Data..., System.ServiceModel..., and System.Web...
Adding reference source for
System.Data
System.Data.DataSetExtensions
System.Data.Entity
System.Data.Entity.Design
System.Data.Linq
System.Data.SqlXml
System.ServiceModel
System.ServiceModel.Activation
System.ServiceModel.Activities
System.ServiceModel.Channels
System.ServiceModel.Discovery
System.ServiceModel.Internals
System.ServiceModel.Routing
System.ServiceModel.WasHosting
System.ServiceModel.Web
System.Web
System.Web.ApplicationServices
System.Web.DynamicData
System.Web.Entity
System.Web.Entity.Design
System.Web.Extensions
System.Web.Mobile
System.Web.Routing
System.Web.Services
System.Xml
System.Xml.Linq
2016-05-03 00:07:37 +02:00

76 lines
2.3 KiB
C#

//----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------------------
using System.Globalization;
namespace System.ServiceModel.Channels
{
public sealed class WebBodyFormatMessageProperty : IMessageProperty
{
WebContentFormat format;
static WebBodyFormatMessageProperty jsonProperty;
public const string Name = "WebBodyFormatMessageProperty";
static WebBodyFormatMessageProperty xmlProperty;
static WebBodyFormatMessageProperty rawProperty;
public WebBodyFormatMessageProperty(WebContentFormat format)
{
if (format == WebContentFormat.Default)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR2.GetString(SR2.DefaultContentFormatNotAllowedInProperty)));
}
this.format = format;
}
public WebContentFormat Format
{
get { return this.format; }
}
internal static WebBodyFormatMessageProperty JsonProperty
{
get
{
if (jsonProperty == null)
{
jsonProperty = new WebBodyFormatMessageProperty(WebContentFormat.Json);
}
return jsonProperty;
}
}
internal static WebBodyFormatMessageProperty XmlProperty
{
get
{
if (xmlProperty == null)
{
xmlProperty = new WebBodyFormatMessageProperty(WebContentFormat.Xml);
}
return xmlProperty;
}
}
internal static WebBodyFormatMessageProperty RawProperty
{
get
{
if (rawProperty == null)
{
rawProperty = new WebBodyFormatMessageProperty(WebContentFormat.Raw);
}
return rawProperty;
}
}
public IMessageProperty CreateCopy()
{
return this;
}
public override string ToString()
{
return String.Format(CultureInfo.InvariantCulture, SR2.GetString(SR2.WebBodyFormatPropertyToString, this.Format.ToString()));
}
}
}