title: SetValidator for complex properties not working
body: <p>I have the following validation class for "Expense" entity:</p>
  
  <pre><code>public class ExpenseBaseValidator : AbstractValidator&lt;Expense&gt;
  {
      public ExpenseBaseValidator()
      {
          RuleFor(x =&gt; x.Description).NotEmpty();
          RuleFor(x =&gt; x.Amount).NotNull();
          RuleFor(x =&gt; x.BusinessID).NotEqual(0).WithMessage("BusinessID is required.");
          RuleFor(x =&gt; x.ExpenseTypeID).NotEqual(0).WithMessage("ExpenseTypeID is required.");
          RuleFor(x =&gt; x.CreatedDate).NotNull();
          RuleFor(x =&gt; x.Transaction).SetValidator(new TransactionValidator());
      }
  }
  </code></pre>
  
  <p>Then I have validation class for Transaction which is a complex property in Expense class above:</p>
  
  <pre><code>public class TransactionBaseValidator : AbstractValidator&lt;Transaction&gt;
  {
      public TransactionBaseValidator()
      {
          RuleFor(x =&gt; x.BankAccountID).NotEqual(0).WithMessage("BankAccountID is required.");
          RuleFor(x =&gt; x.EmployeeID).NotEqual(0).WithMessage("EmployeeID is required.");
          RuleFor(x =&gt; x.TransactionDate).NotNull();
          RuleFor(x =&gt; x.IsWithdrawal).NotNull();
          RuleFor(x =&gt; x.Amount).NotNull();
          RuleFor(x =&gt; x.Description).NotEmpty();
          RuleFor(x =&gt; x.PaymentMethod).NotEmpty();
          RuleFor(x =&gt; x.PaymentMethod).Length(0, 50).WithMessage("PaymentMethod can not exceed 50 characters");
      }
  }
  </code></pre>
  
  <p>Now these are base classes and I call the validator using the following child classes respectively:</p>
  
  <pre><code>public class ExpenseValidator : ExpenseBaseValidator
  {
      public ExpenseValidator()
          : base()
      {
          RuleFor(x =&gt; x.Transaction)
              .NotNull()
              .When(x =&gt; x.IsPaid == true)
              .WithMessage("An account transaction is required when the amount is paid.");
  
          RuleFor(x =&gt; x.DatePaid)
              .NotNull()
              .When(x =&gt; x.IsPaid == true)
              .WithMessage("Please enter the date when the expense was paid.");
      }
  }
  </code></pre>
  
  <p>And Transaction child class:</p>
  
  <pre><code>public class TransactionValidator : TransactionBaseValidator
  {
      public TransactionValidator() : base()
      {
  
      }
  }
  </code></pre>
  
  <p>And these can have extra rules for validation and the base rules are called using the <code>base()</code> constructor.</p>
  
  <p>And I validate the Expense object using this:</p>
  
  <pre><code>var validator = new ExpenseValidator();
  var results = validator.Validate(oExpense);
  </code></pre>
  
  <p>Now this doesn't return the validation for the complex property transaction which I am using in the following way:</p>
  
  <pre><code>oExpense.Transaction = new Transaction();
  oExpense.Transaction.Amount = oExpense.Amount;
  oExpense.Transaction.BankAccountID = ddlAccounts.SelectedItem.Value.ToInt();
  oExpense.Transaction.TransactionDate = oExpense.DatePaid.Value;
  oExpense.Transaction.IsWithdrawal = true;
  oExpense.Transaction.Description = oExpense.Description;
  oExpense.Transaction.IsDeleted = false;
  // I dont set the below and it should give me validation error:
  // oExpense.Transaction.EmployeeID = 10;
  </code></pre>
  
  <p>I don't set the EmployeeID and it should give me validation error when I call validator for expense object as it has <code>SetValidator()</code> for the Transaction property and the Transaction is also not null as I already set <code>new Transaction()</code>.</p>
  
  <p>Any idea?</p>