基于 2 个列表项的流畅验证

时间:2021-03-16 17:14:45

标签: c# fluentvalidation

我的班级有 2 个列表,我需要一个基于 2 个的验证规则

public class StdQA{
      public int Qid {get; set;}
      public int responsetypeid {get; set;}
  }

public class AddlQA{

    public string Qtext {get; set;}
    public int responsetypeid {get; set;}

}

public class CandidateQA{

    public List<StdQA> StdQAs

    public List<AddlQA> AddlQAs
}

我需要使用 FluentValidation 的验证规则如下: 对于候选 QA,StdQAs 和 AddlQAs 中的项目计数总和,其中 responsetypeid = 3 应该 >=5。此外,我们需要确保对于其中 responsetypeid = 3 的 AddlQA,Qtext 不是 null 空白或空白。 我们如何在 c# .Net 中使用 FluentValidation 来实现这一点

0 个答案:

没有答案
相关问题