title: Entity Framework search records with a list of strings?
body: <p>I have a database of records that each have a title. I want to be able to search through this database with a search string that will be separated into a list or an array.</p>
  
  <p>So for example if I search with "Book Dog", it will search for all titles that have "Book" or "Dog" in the title.</p>
  
  <p>I'm using entity framework and I guess the simplest way to write down what I want to do is </p>
  
  <pre><code>string[] words;
  var posts = (from p in ctx.posts
  where p.title.contains(words)
  select p).ToList();
  </code></pre>
  
  <p>I've tried using a StringExtension I found online, but I would get the following error
  "LINQ to Entities does not recognize the method 'Boolean ContainsAny(System.String, System.String[])' method, and this method cannot be translated into a store expression."</p>
  
  <p>And the extension is</p>
  
  <pre><code>public static bool ContainsAny(this string str, params string[] values)
      {
          if (!string.IsNullOrEmpty(str) || values.Length &gt; 0)
          {
              foreach (string value in values)
              {
                  if (str.Contains(value))
                      return true;
              }
          }
  
          return false;
      }
  </code></pre>