I\'m using this library to perform bulk delete in batches like following:
while (castedEndedItems.Any())
{
var subList = castedEndedItems.Take(4000).
If you don't mind the extra dependency, you could use the NuGet package Z.EntityFramework.Plus.
The code is roughly as follows:
using Z.EntityFramework.Plus;
[...]
using (yourDbContext context = new yourDbContext())
{
yourDbContext.yourDbSet.Where( yourWhereExpression ).Delete();
}
It is simple and efficient. The documentation contains exact numbers about the performance.
Regarding licensing: As far as I know, version 1.8 has an MIT license: https://github.com/zzzprojects/EntityFramework-Plus/blob/master/LICENSE The newer version are not free to use.