title: How to use SQL 'LIKE' with LINQ to Entities?
body: <p>I have a textbox that allows a user to specify a search string, including wild cards, for example:</p>
  
  <pre><code>Joh*
  *Johnson
  *mit*
  *ack*on
  </code></pre>
  
  <p>Before using LINQ to Entities, I had a stored procedure which took that string as parameter and did:</p>
  
  <pre><code>SELECT * FROM Table WHERE Name LIKE @searchTerm
  </code></pre>
  
  <p>And then I would just do a String.Replace('*', '%') before passing it in.</p>
  
  <p>Now with LINQ to Entities I am trying to accomplish the same thing. I know there is StartsWith, EndsWith and Contains support, but it won't support it in the way that I need.</p>
  
  <p>I read about "SqlMethods.Like" and tried this:</p>
  
  <pre><code>var people = from t in entities.People
               where SqlMethods.Like(t.Name, searchTerm)
               select new { t.Name };
  </code></pre>
  
  <p>However I am getting the following exception:</p>
  
  <pre><code>LINQ to Entities does not recognize the method 'Boolean Like(System.String, 
  System.String)' method, and this method cannot be translated into a store 
  expression.
  </code></pre>
  
  <p>How would I get this same functionality using LINQ to Entities?</p>