I have to select some items from a database. The IDs of the items are in a List
.
In an answer here, Jon Skeet states that we might use Contains()
var foo = channel.AsQueryable<CodeData>()
.Where(codeData => codeIDs.Contains(codeData.CodeId));
In a context where the database is huge and the IDs list is really small, how does it perform?
Is Linq smart enough to use the IN
clause in SQL?
Edit: I am using DataContext and SQL Server 2008