The 'in' predicate in Entity Framework

533 views Asked by At

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,

1

There are 1 answers

1
wnascimento On

try this:

var Products = from product in dbctx.Products
            where itemQuery.Contains(product.ProductID)
            select product;