I am getting this error while using this IEquality
comparer for intersection. Can somebody identify where I am doing it wrong?
Pleas ask if you need more information.
When you write LINQ to Entities, you must remember that eventually all of your LINQ expression is translated to SQL. So for every method call you make in that expression, you should think if there's a reasonable way to translate it to SQL.
Having that in mind, you can see that:
.ToList()
, which is probably the source of your current error. calls to .ToList()
should be made at the end of the expression, as a way to "materialize" the query (ie make EF make the actual call to the database and return results). IEqualityComparer
to be translatable to SQL.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.