Why is .Contains slow? Most efficient way to get multiple entities by primary key?
UPDATE: With the addition of InExpression in EF6, the performance of processing Enumerable.Contains improved dramatically. The analysis in this answer is great but largely obsolete since 2013. Using Contains in Entity Framework is actually very slow. It’s true that it translates into an IN clause in SQL and that the SQL query itself is executed … Read more