I am using Entity Framework 6.
I have a table with test information called Tests. I am deleting rows from this table by first getting a list of the tests, doing a
Built in Entity Framework .RemoveRange() method, still Fetches the Entries on memory , and issues X deletes looping though all of them.
If you don't want to write Any SQL for Deletion especially when selecting which entities to delete is complex
Entity Framework Plus Library offers batch delete-update methods issuing only one single command.
// Deleting
context.Users
.Where(u => u.FirstName == "firstname")
.Delete();
A current limitations of the Entity Framework is that in order to update or delete an entity you have to first retrieve it into memory. Now in most scenarios this is just fine. There are however some senerios where performance would suffer. Also, for single deletes, the object must be retrieved before it can be deleted requiring two calls to the database. Batch update and delete eliminates the need to retrieve and load an entity before modifying it.