I would like to use a FluentValidation feature called ruleset in a Web API project because it does not I want to have to be doing model validation manually every time an action method is called.
So I used the FluentValidationModelValidatorProvider.Configure
to add the FluentValidation at ModelValidatorProviders
so that my models could be automatically validated before being sent to a action method .
So far so good, but for me to continue configuring FluentValidation in my project, for it to do the validations automatically, I just need to use the CustomizeValidatorAttribute
on the desired models as follows:
public ActionResul Something([CustomizeValidator(RuleSet = "RuleName")]MyModel myModel)
The problem is that this attribute is only available for the more specific FluentValidation package that is intended for ASP.NET MVC. What could I do to have this functionality in the Web API?