Question

I have two different models. In both models some of the validations are the same and some aren't. Is there any way to share parts of validation with fluent validation? So I don't have to maintain duplicate code.

Was it helpful?

Solution

You could use the SetValidator method:

RuleFor(x => x.SomeComplexProperty).SetValidator(new MyValidator());
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top