Hi
You can use a Must rule to do this - the Must method takes a delegate where you can perform custom logic:
You can use a Must rule to do this - the Must method takes a delegate where you can perform custom logic:
class MyValidator:AbstractValidator<Parent> {
public MyValidator() {
RuleFor(x => x.Children).Must(HaveValidChildren);
}
private bool HaveValidChildren(Parent parent, Child[] children) {
// loop over each child and compare to parent as necessary.
}
}
Hope this helps