Class NewtonsoftJsonFormatterOptions
- Assembly
- Codebelt.Extensions.Newtonsoft.Json.dll
Specifies options that is related to NewtonsoftJsonFormatter operations.
public class NewtonsoftJsonFormatterOptions : IExceptionDescriptorOptions, IContentNegotiation, IValidatableParameterObject, IParameterObject
- Inheritance
-
NewtonsoftJsonFormatterOptions
- Implements
Constructors
NewtonsoftJsonFormatterOptions()
Initializes a new instance of the NewtonsoftJsonFormatterOptions class.
public NewtonsoftJsonFormatterOptions()
Remarks
The following table shows the initial property values for an instance of NewtonsoftJsonFormatterOptions.
Property | Initial Value |
---|---|
Settings | Newtonsoft.Json.JsonSerializerSettings |
SynchronizeWithJsonConvert | false |
SensitivityDetails | None |
SupportedMediaTypes |
|
Properties
DefaultConverters
Gets or sets a delegate that is invoked when NewtonsoftJsonFormatterOptions is initialized and propagates registered Newtonsoft.Json.JsonConverter implementations.
public static Action<IList<JsonConverter>> DefaultConverters { get; set; }
Property Value
- Action<IList<JsonConverter>>
The delegate which propagates registered Newtonsoft.Json.JsonConverter implementations when NewtonsoftJsonFormatterOptions is initialized.
DefaultMediaType
Provides the default/fallback media type that the associated formatter should use when content negotiation either fails or is absent.
public static MediaTypeHeaderValue DefaultMediaType { get; }
Property Value
- MediaTypeHeaderValue
The media type that the associated formatter should use when content negotiation either fails or is absent.
SensitivityDetails
Gets or sets a bitwise combination of the enumeration values that specify which sensitive details to include in the serialized result.
public FaultSensitivityDetails SensitivityDetails { get; set; }
Property Value
- FaultSensitivityDetails
The enumeration values that specify which sensitive details to include in the serialized result.
Settings
Gets or sets the settings to support the NewtonsoftJsonFormatter.
public JsonSerializerSettings Settings { get; set; }
Property Value
- JsonSerializerSettings
A Newtonsoft.Json.JsonSerializerSettings instance that specifies a set of features to support the NewtonsoftJsonFormatter object.
SupportedMediaTypes
Gets or sets the collection of MediaTypeHeaderValue elements supported by the NewtonsoftJsonFormatter.
public IReadOnlyCollection<MediaTypeHeaderValue> SupportedMediaTypes { get; set; }
Property Value
- IReadOnlyCollection<MediaTypeHeaderValue>
A collection of MediaTypeHeaderValue elements supported by the NewtonsoftJsonFormatter.
SynchronizeWithJsonConvert
Gets or sets a value indicating whether Settings should be synchronized on Newtonsoft.Json.JsonConvert.DefaultSettings.
public bool SynchronizeWithJsonConvert { get; set; }
Property Value
- Boolean
true
if Settings should be synchronized on Newtonsoft.Json.JsonConvert.DefaultSettings; otherwise,false
.
Methods
ValidateOptions()
Determines whether the public read-write properties of this instance are in a valid state.
public void ValidateOptions()
Remarks
This method is expected to throw exceptions when one or more conditions fails to be in a valid state.
Exceptions
- InvalidOperationException
Settings cannot be null.