The 'in' predicate in the Entity Framework

In T-SQL we have

where empid in (1, 3, 5)

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

Thank,

+5
source share
1 answer

try the following:

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

All Articles