title: How to do an "in" query in entity framework?
body: <p>How can I do a select in linq to entities to select rows with keys from a list?  Something like this:</p>
  
  <pre><code>var orderKeys = new int[] { 1, 12, 306, 284, 50047};
  var orders = (from order in context.Orders 
                where (order.Key in orderKeys) 
                select order).ToList();
  Assert.AreEqual(orderKeys.Count, orders.Count);
  </code></pre>
  
  <p>I tried using the <em>Contains</em> method as mentioned in some of the answers but it does not work and throws this exception:</p>
  
  <p><em>LINQ to Entities does not recognize the method 'Boolean Contains[Int32](System.Collections.Generic.IEnumerable`1[System.Int32], Int32)' method, and this method cannot be translated into a store expression.</em></p>