title: Run an IQueryable with Entity Framework
body: <p>I'm developing an Entity Framework Code First 4.4.0.0 library with C# and .NET Framework 4.0.</p>
  
  <p>I'm searching how can I create query dynamically, using arrays on where clause. And I have found this (<a href="http://www.albahari.com/nutshell/predicatebuilder.aspx" rel="nofollow">here</a>):</p>
  
  <pre><code>IQueryable&lt;Product&gt; SearchProducts (params string[] keywords)
  {
    IQueryable&lt;Product&gt; query = dataContext.Products;
  
    foreach (string keyword in keywords)
    {
      string temp = keyword;
      query = query.Where (p =&gt; p.Description.Contains (temp));
    }
    return query;
  }
  </code></pre>
  
  <p>But I don't know how to use it. <strong>How can I run this query?</strong></p>
  
  <p>I usually do this:</p>
  
  <pre><code>using (var context = new MyContext())
  {
      context.Configuration.ProxyCreationEnabled = false;
  
      var users = from u in context.Users.Include("WhoHasBlockedMe").Include("Friends")
                  from act in u.WantsToDo
                  where act.ActivityId == activityId &amp;&amp;
                      u.Gender == genderId &amp;&amp;
                      u.City == city &amp;&amp;
                      u.Country == countryIsoCode
                  select u;
  
      // This user doesn't exit on database
      if ((users == null) ||
          (users.Count() == 0))
      {
          ctx.StatusCode = System.Net.HttpStatusCode.NotFound;
          ctx.SuppressEntityBody = true;
      }
      else
      {
          usersList = new List&lt;UserProfile&gt;();
          foreach(User us in users.ToList())
          {
              usersList.Add(UserProfile.CreateUserView(us, userId));
          }
          ctx.StatusCode = System.Net.HttpStatusCode.OK;
      }
  }
  </code></pre>
  
  <p><strong>How can I run that query?</strong></p>