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
descriptorHttpParameterDescriptorThe descriptor.
formattersIEnumerable<MediaTypeFormatter>The formatter.
bodyModelValidatorIBodyModelValidatorThe 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
metadataProviderModelMetadataProviderThe metadata provider.
actionContextHttpActionContextThe context associated with the action.
cancellationTokenCancellationTokenThe 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
requestHttpRequestMessageThe request.
typeTypeThe type.
formattersIEnumerable<MediaTypeFormatter>The formatter.
formatterLoggerIFormatterLoggerThe format logger.
Returns
ReadContentAsync(HttpRequestMessage, Type, IEnumerable<MediaTypeFormatter>, IFormatterLogger, CancellationToken)
public virtual Task<object> ReadContentAsync(HttpRequestMessage request, Type type, IEnumerable<MediaTypeFormatter> formatters, IFormatterLogger formatterLogger, CancellationToken cancellationToken)
Parameters
requestHttpRequestMessagetypeTypeformattersIEnumerable<MediaTypeFormatter>formatterLoggerIFormatterLoggercancellationTokenCancellationToken