I am trying to do something like this :
RuleFor(client => client.PriceCustomization.GroupBy(a=>a.ProductId).Select(a => a.ToList()))
.SetCollectionValidator(new PriceCustomizationsForProductValidator());
But I am receiving this error : Failed: System.InvalidOperationException : Nested validators can only be used with Member Expressions.
"PriceCustomizationsForProductValidator" is a validator for a List of "PriceCustomization"
Does anyone have any idea how could I solve this?
Using FluentValidation
version 8, try this:
RuleForEach(client => client.PriceCustomization)
.SetValidator(new PriceCustomizationsForProductValidator());
See https://fluentvalidation.net/upgrading-to-8.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With