InputFormatter Class

Summary

Reads an object from the request body.

Syntax

public abstract class InputFormatter : IInputFormatter

GitHub

View on GitHub

class Microsoft.AspNet.Mvc.InputFormatter

Properties

SupportedEncodings()

Gets the mutable collection of character encodings supported by this [Microsoft.AspNet.Mvc.InputFormatter](Microsoft.AspNet.Mvc.InputFormatter.yml). The encodings are used when reading the data.

Return type:System.Collections.Generic.IList{System.Text.Encoding}
public IList<Encoding> SupportedEncodings { get; }
SupportedMediaTypes()

Gets the mutable collection of @!:MediaTypeHeaderValue- elements supported by this [Microsoft.AspNet.Mvc.InputFormatter](Microsoft.AspNet.Mvc.InputFormatter.yml).

Return type:System.Collections.Generic.IList{MediaTypeHeaderValue}
public IList<MediaTypeHeaderValue> SupportedMediaTypes { get; }

Methods

CanRead(Microsoft.AspNet.Mvc.InputFormatterContext)
Arguments:
Return type:

System.Boolean

public virtual bool CanRead(InputFormatterContext context)
CanReadType(System.Type)

Returns a value indicating whether or not the given type can be read by this serializer.

Arguments:
  • type (System.Type) – The type of object that will be read.
Return type:

System.Boolean

Returns:

<c>true</c> if the type can be read, otherwise <c>false</c>.

protected virtual bool CanReadType(Type type)
GetDefaultValueForType(System.Type)
Arguments:
  • modelType (System.Type) –
Return type:

System.Object

protected object GetDefaultValueForType(Type modelType)
ReadAsync(Microsoft.AspNet.Mvc.InputFormatterContext)
Arguments:
Return type:

System.Threading.Tasks.Task{System.Object}

public virtual Task<object> ReadAsync(InputFormatterContext context)
ReadRequestBodyAsync(Microsoft.AspNet.Mvc.InputFormatterContext)

Reads the request body.

Arguments:
Return type:

System.Threading.Tasks.Task{System.Object}

Returns:

A task which can read the request body.

public abstract Task<object> ReadRequestBodyAsync(InputFormatterContext context)
SelectCharacterEncoding(MediaTypeHeaderValue)

Returns encoding based on content type charset parameter.

Arguments:
  • contentType (MediaTypeHeaderValue) –
Return type:

System.Text.Encoding

protected Encoding SelectCharacterEncoding(MediaTypeHeaderValue contentType)