title: FluentValidation calling method with two parameters
body: <p>I have the following FluentValidation code which I need to change so that the validation calls the IsUniqueCode function and also passes the currentID parameter which is the id of the Language object been validated.</p>
  
  <pre class="lang-cs prettyprint-override"><code> public class LanguageValidator : AbstractValidator&lt;Language&gt;
  {
      public LanguageValidator()
      {
          RuleFor(x =&gt; x.Code).NotEmpty().WithMessage("Language code is required").Length(0, 100);
          RuleFor(x =&gt; x.Code).Must(IsUniqueCode).WithMessage("Language code provided already exists");
      }
  
      private bool IsUniqueCode(string code, int currentID)
      {
          var _db = new MyDbContext();
          var language = _db.Languages.SingleOrDefault(x =&gt; x.Code == code);
  
          if (language== null) return true;
  
          return (language.LanguageId != currentID);
  
      }
  }
  </code></pre>
  
  <p>This is so that the second time I save the object it doesn't fail the validation that the Language code provided already exists.</p>
  
  <p>The above code doesn't compile because of  </p>
  
  <pre class="lang-cs prettyprint-override"><code>RuleFor(x =&gt; x.Code)
      .Must(**IsUniqueCode**)
      .WithMessage("Language code provided already exists");
  </code></pre>