title: How do you check if a string contains any strings from a list in Entity Framework?
body: <p>I am trying to search a database to see if a string contains elements of a list of search terms.</p>
  
  <pre><code>var searchTerms = new List&lt;string&gt; { "car", "232" };
  var result = context.Data.Where(data =&gt; data.Name.Contains(searchTerms) ||
                                          data.Code.Contains(searchTerms));
  </code></pre>
  
  <p>This would work if searchTerms was a string but I've been trying to get it to work with a list of strings.</p>
  
  <p>Essentially I need SQL which would say</p>
  
  <pre><code>SELECT * FROM Data
  WHERE Name LIKE '%car%'
  OR Name LIKE '%232%'
  OR Code LIKE '%car%'
  OR Code LIKE '%232%'
  </code></pre>
  
  <p><a href="https://stackoverflow.com/questions/10667675/linq-where-list-contains-any-in-list">linq where list contains any in list</a> seems to be the closes thing I could find to the situation.</p>
  
  <p><code>Where(data =&gt; searchTerms.Contains(data.Name) || searchTerms.Contains(data.Code)</code> only brings back exact matches to the search terms list.</p>
  
  <p>I have tried searching for multiple keyword search in Entity Framework also and have exhausted that effort. Is there any way to achieve what I am aiming for?</p>