Table of Contents

Class FormatterParameterBinding

Namespace
System.Web.Http.ModelBinding
Assembly
System.Web.Http.dll

Represents parameter binding that will read from the body and invoke the formatters.

public class FormatterParameterBinding : HttpParameterBinding
Inheritance
FormatterParameterBinding
Inherited Members

Constructors

FormatterParameterBinding(HttpParameterDescriptor, IEnumerable<MediaTypeFormatter>, IBodyModelValidator)

Initializes a new instance of the FormatterParameterBinding class.

public FormatterParameterBinding(HttpParameterDescriptor descriptor, IEnumerable<MediaTypeFormatter> formatters, IBodyModelValidator bodyModelValidator)

Parameters

descriptor HttpParameterDescriptor

The descriptor.

formatters IEnumerable<MediaTypeFormatter>

The formatter.

bodyModelValidator IBodyModelValidator

The body model validator.

Properties

BodyModelValidator

Gets or sets an interface for the body model validator.

public IBodyModelValidator BodyModelValidator { get; set; }

Property Value

IBodyModelValidator

An interface for the body model validator.

ErrorMessage

Gets the error message.

public override string ErrorMessage { get; }

Property Value

string

The error message.

Formatters

Gets or sets an enumerable object that represents the formatter for the parameter binding.

public IEnumerable<MediaTypeFormatter> Formatters { get; set; }

Property Value

IEnumerable<MediaTypeFormatter>

An enumerable object that represents the formatter for the parameter binding.

WillReadBody

Gets whether the FormatterParameterBindingwill read body.

public override bool WillReadBody { get; }

Property Value

bool

True if the FormatterParameterBindingwill read body; otherwise, false.

Methods

ExecuteBindingAsync(ModelMetadataProvider, HttpActionContext, CancellationToken)

Asynchronously execute the binding of FormatterParameterBinding.

public override Task ExecuteBindingAsync(ModelMetadataProvider metadataProvider, HttpActionContext actionContext, CancellationToken cancellationToken)

Parameters

metadataProvider ModelMetadataProvider

The metadata provider.

actionContext HttpActionContext

The context associated with the action.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

The result of the action.

ReadContentAsync(HttpRequestMessage, Type, IEnumerable<MediaTypeFormatter>, IFormatterLogger)

Asynchronously reads the content of FormatterParameterBinding.

public virtual Task<object> ReadContentAsync(HttpRequestMessage request, Type type, IEnumerable<MediaTypeFormatter> formatters, IFormatterLogger formatterLogger)

Parameters

request HttpRequestMessage

The request.

type Type

The type.

formatters IEnumerable<MediaTypeFormatter>

The formatter.

formatterLogger IFormatterLogger

The format logger.

Returns

Task<object>

The result of the action.