如何在子验证中使用父属性?

时间:2019-05-16 21:19:07

标签: fluentvalidation

使用FluentValidation 8.0,我有一个Project类验证器:

public class Project {
  public Boolean Enabled { get; set; }
  public List<Task> Tasks { get; set; }
}

RuleFor(x => x.Tasks)
  .Must(x => x.Count() > 0)
  .ForEach(y => {
     y.SetValidator(z => new InlineValidator<Task> {
       u => u.RuleFor(v => v.Approved)
               .Must((v, c) => ???)
        });
      });

如何访问Enabled的{​​{1}}(???)内Project的属性Must

0 个答案:

没有答案