Updated on Kisan Patel
Problem:
How to write “WHERE IN” style queries using LINQ to Entities?
Solution:
In the LINQ (to objects) world there is no ‘WHERE IN’ so you need to use the Contains
method like this:
List<int> model = new List<int>() {4, 5, 6, 9, 10}; var users = context.Users.Where(x => model.Contains(x.Id)).ToList();