4

In T-SQL, we have

where empid in (1, 3, 5)

Now suppose I have a List<int>, how do I write a LINQ to Entities query, namely a predicate for Where() to get the equivalent of the above SQL query? Or this is not supported at all?

Thanks,

abatishchev
  • 95,331
  • 80
  • 293
  • 426
Dodd
  • 510
  • 3
  • 17

1 Answers1

4

try this:

var Products = from product in dbctx.Products
            where itemQuery.Contains(product.ProductID)
            select product;
wnascimento
  • 1,929
  • 1
  • 19
  • 16