I would like to use the FluentValidation function in a web API project because I don’t want to perform manual checks, so I use FluentValidationModelValidatorProvider.Configureto add FluentValidation to ModelValidatorProvidersso that I automatically check my models before submitting the action method.
Up to this point, everything is fine and working correctly, but what if I decide to use the rule set function? When it comes to automatic verification, the examples you see on the Internet use CustomizeValidatorAttributethis:
public ActionResul Something([CustomizeValidator(RuleSet = "RuleName")]MyModel myModel)
But the problem is that CustomizeValidator is only available for ASP.NET MVC, so what should I do to have at least the same behavior in the web API?
source
share