title: ViewModel validation for a List
body: <p>I have the following viewmodel definition</p>
  
  <pre><code>public class AccessRequestViewModel
  {
      public Request Request { get; private set; }
      public SelectList Buildings { get; private set; }
      public List&lt;Person&gt; Persons { get; private set; }
  }
  </code></pre>
  
  <p>So in my application there must be at least 1 person for an access request.  What approach might you use to validate? I don't want this validation to happen in my controller which would be simple to do. Is the only choice a custom validation attribute?</p>
  
  <p><strong>Edit:</strong> Currently performing this validation with FluentValidation (nice library!)</p>
  
  <pre><code>RuleFor(vm =&gt; vm.Persons)
                  .Must((vm, person) =&gt; person.Count &gt; 0)
                  .WithMessage("At least one person is required");
  </code></pre>