<p>I'm using LINQ to Entities (not LINQ to SQL) and I'm having trouble creating an 'IN' style query.  Here is my query at the moment:</p>

<pre><code>var items = db.InventoryItem
                .Include("Kind")
                .Include("PropertyValues")
                .Include("PropertyValues.KindProperty")
                .Where(itm =&gt; valueIds.Contains(itm.ID)).ToList&lt;InventoryItem&gt;();
</code></pre>

<p>When I do this however, the following exception is thrown:</p>

<blockquote>
  <p>LINQ to Entities does not recognize the method 'Boolean Contains(Int64)' method, and this method cannot be translated into a store expression.</p>
</blockquote>

<p>Does anyone have a workaround or another solution for this?</p>

You need to either use this one:
```
```
.Where(string.Format("it.ID in {0}", string.Join(",", valueIds.ToArray())));
```
```
or construct the WHERE part dynamically, as in
this
post.
P.S. - Information has been updated and this answer updated as follows to maintain relevance:
The link referenced contains the following update:
...in EF4 we added support for the
Contains method and at least in this
specific case for collection-valued
parameters. Therefore this kind of
code now works right out of the box
and it is not necesary to use any
additinal expression building method:
```
```
var statusesToFind = new List<int> {1, 2, 3, 4};
var foos = from foo in myEntities.Foos
           where statusesToFind.Contains(foo.Status)
           select foo;
```
```