Class ODataMediaTypeFormatter
System.Net.Http.Formatting.MediaTypeFormatter class to handle OData.
public class ODataMediaTypeFormatter : MediaTypeFormatter
- Inheritance
-
ODataMediaTypeFormatter
Constructors
ODataMediaTypeFormatter(IEnumerable<ODataPayloadKind>)
Initializes a new instance of the ODataMediaTypeFormatter class.
public ODataMediaTypeFormatter(IEnumerable<ODataPayloadKind> payloadKinds)
Parameters
payloadKinds
IEnumerable<ODataPayloadKind>The kind of payloads this formatter supports.
ODataMediaTypeFormatter(ODataDeserializerProvider, ODataSerializerProvider, IEnumerable<ODataPayloadKind>)
Initializes a new instance of the ODataMediaTypeFormatter class.
public ODataMediaTypeFormatter(ODataDeserializerProvider deserializerProvider, ODataSerializerProvider serializerProvider, IEnumerable<ODataPayloadKind> payloadKinds)
Parameters
deserializerProvider
ODataDeserializerProviderThe ODataDeserializerProvider to use.
serializerProvider
ODataSerializerProviderThe ODataSerializerProvider to use.
payloadKinds
IEnumerable<ODataPayloadKind>The kind of payloads this formatter supports.
Properties
DeserializerProvider
Gets the ODataDeserializerProvider that will be used by this formatter instance.
public ODataDeserializerProvider DeserializerProvider { get; }
Property Value
MessageReaderQuotas
Gets the Microsoft.Data.OData.ODataMessageQuotas that this formatter uses on the read side.
public ODataMessageQuotas MessageReaderQuotas { get; }
Property Value
- ODataMessageQuotas
MessageReaderSettings
Gets the Microsoft.Data.OData.ODataMessageReaderSettings to be used while reading requests.
public ODataMessageReaderSettings MessageReaderSettings { get; }
Property Value
- ODataMessageReaderSettings
MessageWriterQuotas
Gets the Microsoft.Data.OData.ODataMessageQuotas that this formatter uses on the write side.
public ODataMessageQuotas MessageWriterQuotas { get; }
Property Value
- ODataMessageQuotas
MessageWriterSettings
Gets the Microsoft.Data.OData.ODataMessageWriterSettings to be used while writing responses.
public ODataMessageWriterSettings MessageWriterSettings { get; }
Property Value
- ODataMessageWriterSettings
SerializerProvider
Gets the ODataSerializerProvider that will be used by this formatter instance.
public ODataSerializerProvider SerializerProvider { get; }
Property Value
Methods
CanReadType(Type)
public override bool CanReadType(Type type)
Parameters
type
Type
Returns
CanWriteType(Type)
public override bool CanWriteType(Type type)
Parameters
type
Type
Returns
GetPerRequestFormatterInstance(Type, HttpRequestMessage, MediaTypeHeaderValue)
public override MediaTypeFormatter GetPerRequestFormatterInstance(Type type, HttpRequestMessage request, MediaTypeHeaderValue mediaType)
Parameters
type
Typerequest
HttpRequestMessagemediaType
MediaTypeHeaderValue
Returns
- MediaTypeFormatter
ReadFromStreamAsync(Type, Stream, HttpContent, IFormatterLogger)
public override Task<object> ReadFromStreamAsync(Type type, Stream readStream, HttpContent content, IFormatterLogger formatterLogger)
Parameters
type
TypereadStream
Streamcontent
HttpContentformatterLogger
IFormatterLogger
Returns
SetDefaultContentHeaders(Type, HttpContentHeaders, MediaTypeHeaderValue)
public override void SetDefaultContentHeaders(Type type, HttpContentHeaders headers, MediaTypeHeaderValue mediaType)
Parameters
type
Typeheaders
HttpContentHeadersmediaType
MediaTypeHeaderValue
WriteToStreamAsync(Type, object, Stream, HttpContent, TransportContext, CancellationToken)
public override Task WriteToStreamAsync(Type type, object value, Stream writeStream, HttpContent content, TransportContext transportContext, CancellationToken cancellationToken)
Parameters
type
Typevalue
objectwriteStream
Streamcontent
HttpContenttransportContext
TransportContextcancellationToken
CancellationToken