Using EntityFramework 4. I have an EntityCollection<SomeEntity> currentEntities
with ~500k entities and a List<SomeEntity> importedEntities
also with ~500k records. I want to have the list of all records occuring in currentEntities
which don't exist in importedEntities
.
Calling currentEntities.Select(x => x.ID).Except(importedEntities.Select(x => x.ID))
to get unique IDs of occurring records causes a System.OutOfMemoryException
because it apparently loads all of the entities into the memory.
Calling currentEntities.Where(x => !importedEntities.Any(y => y.ID == x.ID))
fails with NotSupportedException
("Only primitive types ('such as Int32, String, and Guid') are supported in this context").
currentEntities
is on the SQL Server 2008 R2 database, while importedEntities
are in memory.
Is this even possible in L2E ?