public override Task ExecuteBindingAsync(ModelMetadataProvider metadataProvider, HttpActionContext actionContext, CancellationToken cancellationToken) { HttpParameterDescriptor paramFromBody = this.Descriptor; Type type = paramFromBody.ParameterType; HttpRequestMessage request = actionContext.ControllerContext.Request; IFormatterLogger formatterLogger = new ModelStateFormatterLogger(actionContext.ModelState, paramFromBody.ParameterName); return(ExecuteBindingAsyncCore(metadataProvider, actionContext, paramFromBody, type, request, formatterLogger, cancellationToken)); }
public override Task ExecuteBindingAsync(System.Web.Http.Metadata.ModelMetadataProvider metadataProvider, HttpActionContext actionContext, CancellationToken cancellationToken) { var paramFromBody = Descriptor; var type = paramFromBody.ParameterType; var request = actionContext.ControllerContext.Request; var formatterLogger = new ModelStateFormatterLogger(actionContext.ModelState, paramFromBody.ParameterName); return(ExecuteBindingAsyncCore(metadataProvider, actionContext, paramFromBody, type, request, formatterLogger, cancellationToken)); }
public override Task ExecuteBindingAsync(ModelMetadataProvider metadataProvider, HttpActionContext actionContext, CancellationToken cancellationToken) { HttpParameterDescriptor paramFromBody = this.Descriptor; Type type = paramFromBody.ParameterType; HttpRequestMessage request = actionContext.ControllerContext.Request; IFormatterLogger formatterLogger = new ModelStateFormatterLogger(actionContext.ModelState, paramFromBody.ParameterName); Task <object> task = ReadContentAsync(request, type, _formatters, formatterLogger); return(task.Then( (model) => { // Put the parameter result into the action context. SetValue(actionContext, model); // validate the object graph. // null indicates we want no body parameter validation if (BodyModelValidator != null) { BodyModelValidator.Validate(model, type, metadataProvider, actionContext, paramFromBody.ParameterName); } })); }