title: LINQ custom function in .where
body: <p>can I, and if I can, how, write LINQ statement like this: </p>
  
  <pre><code>public IQueryable&lt;Advert&gt; SearchSimilarAdverst(string query)
      {
          Levenshtein compute = new Levenshtein();
          return _db.Adverts.Where(a =&gt; a.IsActive  &amp;&amp; 
                (compute.FindSimilarity(a.Name, query) &lt;= 2));
      }
  </code></pre>
  
  <p>Thanks </p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I've tired solution <a href="https://stackoverflow.com/users/212566/jeffery-khan">Jeffery</a> suggested and it worked but when I've tried this line of code I got EntityCommandExecutionException, does anybody know why ?</p>
  
  <pre><code>adverts.Where(a =&gt; a.WhoAmILookingForTags.Any
               (t =&gt; compute.FindSimilarity(t.Name,query) &lt;= 2));
  </code></pre>
  
  <p>Tags and Adverts are connected with many to many relation, and WhoAmILookingForTags is list of tags</p>