title: FluentValidation - Validating a View Model that contains a list of an Object
body: <p>I am trying out FluentValidation on a project that contains complex view models and I read the <a href="https://fluentvalidation.codeplex.com/wikipage?title=CreatingAValidator&amp;referringTitle=Documentation&amp;ANCHOR#ReusingValidators">documentation here</a> but I don't see how to set up the rules to validate a list of objects declared in my view model. In my example below, the list in the view model contains 1 or more Guitar objects. Thanks</p>
  
  <p><strong>View Model</strong></p>
  
  <pre><code> [FluentValidation.Attributes.Validator(typeof(CustomerViewModelValidator))]
      public class CustomerViewModel
      {
          [Display(Name = "First Name")]
          public string FirstName { get; set; }
  
          [Display(Name = "Last Name")]
          public string LastName { get; set; }
  
          [Display(Name = "Phone")]
          public string Phone { get; set; }
  
          [Display(Name = "Email")]
          public string EmailAddress { get; set; }
  
          public List&lt;Guitar&gt; Guitars { get; set; } 
      }
  </code></pre>
  
  <p><strong>Guitar class used in View Model</strong></p>
  
  <pre><code>public class Guitar
  {
      public string Make { get; set; }
      public string Model { get; set; }
      public int? ProductionYear { get; set; }
  }
  </code></pre>
  
  <p><strong>View Model Validator Class</strong></p>
  
  <pre><code> public class CustomerViewModelValidator : AbstractValidator&lt;CustomerViewModel&gt;
      {
  
  
          public CustomerViewModelValidator()
          {
              RuleFor(x =&gt; x.FirstName).NotNull();
              RuleFor(x =&gt; x.LastName).NotNull();
              RuleFor(x =&gt; x.Phone).NotNull();
              RuleFor(x =&gt; x.EmailAddress).NotNull();
             //Expects an indexed list of Guitars here????
  
  
          }
      }
  </code></pre>