Class FluentValidationFilterAttribute
- Namespace
- Magicalizer.Api
- Assembly
- Magicalizer.dll
Validates action arguments with the registered FluentValidation validators (FluentValidation.IValidator<T>) before the action is executed and adds validation errors to the model state. Asynchronous validation rules are supported. The rule sets to validate are set by ValidationRuleSetAttribute on the parameter. It runs before ApiControllerAttribute rejects the requests with the model state errors, so the client gets all the errors of the request at once.
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Method)]
public class FluentValidationFilterAttribute : ActionFilterAttribute, IActionFilter, IAsyncActionFilter, IResultFilter, IAsyncResultFilter, IOrderedFilter, IFilterMetadata
- Inheritance
-
FluentValidationFilterAttribute
- Implements
- Inherited Members
Constructors
FluentValidationFilterAttribute()
Creates a filter. It runs before the filter of ApiControllerAttribute (-2000).
public FluentValidationFilterAttribute()
Methods
OnActionExecutionAsync(ActionExecutingContext, ActionExecutionDelegate)
Called asynchronously before the action, after model binding is complete.
public override Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
Parameters
contextActionExecutingContextnextActionExecutionDelegateThe ActionExecutionDelegate. Invoked to execute the next action filter or the action itself.