Class FormMultipartEncodedMediaTypeFormatter
Represents the System.Net.Http.Formatting.MediaTypeFormatter class to handle multi-part form-data.
Inheritance
Inherited Members
Namespace: Cqrs.WebApi.Formatters.FormMultipart
Assembly: Cqrs.WebApi.dll
Syntax
public class FormMultipartEncodedMediaTypeFormatter : MediaTypeFormatter
Constructors
FormMultipartEncodedMediaTypeFormatter(MultipartFormatterSettings)
Instantiate and initialise a new instance of FormMultipartEncodedMediaTypeFormatter
Declaration
public FormMultipartEncodedMediaTypeFormatter(MultipartFormatterSettings settings = null)
Parameters
Type | Name | Description |
---|---|---|
MultipartFormatterSettings | settings | The MultipartFormatterSettings to use. |
Methods
CanReadType(Type)
Queries whether this System.Net.Http.Formatting.MediaTypeFormatter can deserialise an object of the specified type.
Declaration
public override bool CanReadType(Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | The System.Type to deserialise. |
Returns
Type | Description |
---|---|
System.Boolean | true if the System.Net.Http.Formatting.MediaTypeFormatter can deserialise the |
Overrides
CanWriteType(Type)
Queries whether this System.Net.Http.Formatting.MediaTypeFormatter can serialise an object of the specified type.
Declaration
public override bool CanWriteType(Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | The System.Type to serialise. |
Returns
Type | Description |
---|---|
System.Boolean | true if the System.Net.Http.Formatting.MediaTypeFormatter can serialise the |
Overrides
ReadFromStreamAsync(Type, Stream, HttpContent, IFormatterLogger)
Asynchronously deserialises an object of the specified type.
Declaration
public override Task<object> ReadFromStreamAsync(Type type, Stream readStream, HttpContent content, IFormatterLogger formatterLogger)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | The System.Type of the object to deserialise. |
System.IO.Stream | readStream | The System.IO.Stream to read. |
System.Net.Http.HttpContent | content | The System.Net.Http.HttpContent, if available. It may be null. |
System.Net.Http.Formatting.IFormatterLogger | formatterLogger | The System.Net.Http.Formatting.IFormatterLogger to log events to. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Object> | A System.Threading.Tasks.Task whose result will be an object of the given type. |
Overrides
SetDefaultContentHeaders(Type, HttpContentHeaders, MediaTypeHeaderValue)
Sets the default headers for content that will be formatted using this formatter.
This method is called from the System.Net.Http.ObjectContent constructor..
This implementation sets the Content-Type header to the value of mediaType
if it is not null.
If it is null it sets the Content-Type to the default media type of this formatter.
If the Content-Type does not specify a charset it will set it using this formatters configured System.Text.Encoding.
Declaration
public override void SetDefaultContentHeaders(Type type, HttpContentHeaders headers, MediaTypeHeaderValue mediaType)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | The System.Type of the object being serialized. See System.Net.Http.ObjectContent. |
System.Net.Http.Headers.HttpContentHeaders | headers | The content headers that should be configured. |
System.Net.Http.Headers.MediaTypeHeaderValue | mediaType | The authoritative media type. Can be null. |
Overrides
WriteToStreamAsync(Type, Object, Stream, HttpContent, TransportContext)
Asynchronously writes an object of the specified type.
Declaration
public override Task WriteToStreamAsync(Type type, object value, Stream writeStream, HttpContent content, TransportContext transportContext)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | The System.Type of the object to write. |
System.Object | value | The object value to write. It may be null. |
System.IO.Stream | writeStream | The System.IO.Stream to write to. |
System.Net.Http.HttpContent | content | The System.Net.Http.HttpContent, if available. It may be null. |
System.Net.TransportContext | transportContext | The System.Net.TransportContext if available. It may be null. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that will perform the write. |