title: How to add a non-property rule in FluentValidation?
body: <p>I have this validator class:</p>
  
  <pre><code>internal class CustomerTypeValidator : AbstractValidator&lt;CustomerType&gt;
  {
      public CustomerTypeValidator()
      {
          RuleFor(x =&gt; x.Number).Must(BeANumber).WithState(x =&gt; CustomerTypeError.NoNumber);
      }
  
      private bool BeANumber(string number)
      {
          int temp;
          bool ok = int.TryParse(number, out temp);
  
          return ok &amp;&amp; temp &gt; 0;
      }
  }
  </code></pre>
  
  <p>And I have the service class:</p>
  
  <pre><code>public class CustomerTypeService
  {
     public CustomerType Save(CustomerType customerType)
      {
          ValidationResult results = Validate(customerType);
          if (results != null &amp;&amp; !results.IsValid)
          {
              throw new ValidationException&lt;CustomerTypeError&gt;(results.Errors);
          }
  
          //Save to DB here....
  
          return customerType;
      }
  
      public bool IsNumberUnique(CustomerType customerType)
      {
          var result = customerTypeRepository.SearchFor(x =&gt; x.Number == customerType.Number).Where(x =&gt; x.Id != customerType.Id).FirstOrDefault();
  
          return result == null;
      }
  
      public ValidationResult Validate(CustomerType customerType)
      {
          CustomerTypeValidator validator = new CustomerTypeValidator();
          validator.RuleFor(x =&gt; x).Must(IsNumberUnique).WithState(x =&gt; CustomerTypeError.NumberNotUnique);
          return validator.Validate(customerType);
      }
  }
  </code></pre>
  
  <p>However I get the following exception:</p>
  
  <p><code>Property name could not be automatically determined for expression x =&gt; x. Please specify either a custom property name by calling 'WithName'.</code></p>
  
  <p>Is the above not the correct way to add an extra rule?</p>