title: Specification pattern for repository?
body: <p>Inspired by <a href="http://huyrua.wordpress.com/2010/08/25/specification-pattern-in-entity-framework-4-revisited" rel="nofollow">http://huyrua.wordpress.com/2010/08/25/specification-pattern-in-entity-framework-4-revisited</a> i have decided to write all nontrivial queries over specifications.
  But у encountered a problem that i dont know how to use one specification in a few functions:</p>
  
  <pre><code>public bool CheckAccountEmailExist(string email)
  {
      var emailExistSpec = new Specification(a =&gt; a.Email.ToUpper() == email.ToUpper());
      return _accountRepository.GetBy(emailExistSpec).Any();
  }
  
  public bool CheckAccountEmailExist(string email, Guid exceptAccountId)
  {
      var emailExistSpec = new Specification(a =&gt; a.Email.ToUpper() == email.ToUpper());
      var exceptAccountSpec = new Specification(a =&gt; a.Id != exceptAccountId);
      return _accountRepository.GetBy(emailExistSpec.And(exceptAccountSpec)).Any();
  }
  </code></pre>
  
  <p>I want to extract specification “a => a.Email.ToUpper() == email.ToUpper()” to use it in both functions, but i should parametrize it with “email” (function parameter). How can I do this?</p>