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
HttpParameterDescriptorThe descriptor.
formatters
IEnumerable<MediaTypeFormatter>The formatter.
bodyModelValidator
IBodyModelValidatorThe 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
ModelMetadataProviderThe metadata provider.
actionContext
HttpActionContextThe context associated with the action.
cancellationToken
CancellationTokenThe 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
HttpRequestMessageThe request.
type
TypeThe type.
formatters
IEnumerable<MediaTypeFormatter>The formatter.
formatterLogger
IFormatterLoggerThe format logger.