Possible Duplicate:
'Contains()' workaround using Linq to Entities?
Hi every one. I would like to know how to write the "WHERE IN" query in LINQ to Entity.
I have tried with the following code:
string[] strings = GetRequest("userID").Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
List<long> longs = strings.Select(x => long.Parse(x)).ToList();
List<Users> users = DataContext.Users.Where(u => longs.Contains(u.ID)).ToList();
But, I get the following error:
System.NotSupportedException: LINQ to Entities does not recognize the method 'Boolean Contains(Int64)' method, and this method cannot be translated into a store expression.
Please help me. Thanks a lot!