title: Generic Repository Linq2Sql impedence mismatch problem
body: <p>I am working on a repository pattern where the API look as follows:</p>
  
  <pre><code>var visitor = repository.Find(x =&gt; x.EmailAddress == credentials.EmailAddress &amp;&amp;
                                x.Password == credentials.Password);
  </code></pre>
  
  <p>where visitor is a domain object and x represents this domain object.  The method signature of the Find method on the repository is:</p>
  
  <pre><code>T Find(Func&lt;T, bool&gt; query);
  </code></pre>
  
  <p>This is all wonderful until I attempt to use this with Linq2Sql because linq2sql creates its own objects and as a result when I want to call: </p>
  
  <pre><code>context.visitors.FirstOrDefault(query); 
  </code></pre>
  
  <p>there is a type mismatch because linq2sql expects a function of the type it created and not the function I am passing in.</p>