An operation on an IQueryable
(in the case of Linq to Entities) is translated to SQL and executed in the database. Since you have an IEqualityComparer
written in C#, the comparer can't be translated to SQL and the overload can't be supported.
When you translate it to an IEnumerable
using AsEnumerable()
, all the data is transferred from the database to memory, where the overload can be easily supported. The downside of course being that you're transferring more data than necessary (potentially the whole table) to have it filtered in memory.