title: How to Ignore FluentValidation rule if object is null
body: <p>How to Ignore FluentValidation rule for null object. 
  I have validator class as </p>
  
  <pre><code>public class RequestModel
  {
      public int? RecordCount { get; set; } = 100;
  }
  
  public class ModelValidator : AbstractValidator&lt;RequestModel&gt;
  {
      public ModelValidator()
      {
         When(x =&gt; x != null, () =&gt;
         {
             RuleFor(item =&gt; item.RecordCount)
               .Cascade(CascadeMode.StopOnFirstFailure)
               .Must(x =&gt; x == null || (x.Value &gt; 0 &amp;&amp; x.Value &lt;= 1000))
                .WithMessage($"Invalid Limit. Limit must be between 1 and {1000}. (inclusive) ");
          });
      }
  }
  </code></pre>
  
  <p>Here I wanted to validate record count only if it passed. 
  But when I pass the null object to api body, it is giving error as </p>
  
  <p>Bad Request. The request has some invalid parameters or not enough of them.</p>