Entity Framework Batch Delete Discover who support this features
Introduction
Batch Delete allows you to improve EF performance by deleting multiple records in a database from a LINQ Query without loading entities.
Why Batch Delete?
For HUGE performance gains, everything is executed on the database side. To use batch delete, you will need to use a third-party library.
Google Related Searches
StackOverflow Related Questions
- How do I delete multiple rows in Entity Framework (without foreach)
- How to Delete multiple records in Linq to Entity?
- Bulk-deleting in LINQ to Entities
// using Z.EntityFramework.Plus; // Don't forget to include this. // DELETE all users inactive for 2 years ctx.Users.Where(x => x.LastLoginDate < DateTime.Now.AddYears(-2)) .Delete(); // DELETE using a BatchSize ctx.Users.Where(x => x.LastLoginDate < DateTime.Now.AddYears(-2)) .Delete(x => x.BatchSize = 1000);
Supported Libraries
Library | Type | EF Version | Support | Doc | Features |
---|---|---|---|---|---|
Z.EntityFramework.Classic | FREE/PRO | EF6 | < 1 Day | Yes | Bulk SaveChanges Bulk Insert Bulk Update Bulk Delete Bulk Merge Batch Delete Batch Update Cache Deferred Query Future |
Z.EntityFramework.Plus | FREE | EF5 EF6 EF Core |
< 1 Day | Yes | Audit Batch Delete Batch Update Cache Deferred Query Filter Future Include Filter Include Optimized |
Unsuported Libraries
Use these libraries at your risk!
Library | Type | EF Version | Support | Doc | Features |
---|---|---|---|---|---|
EFUtilities | FREE | EF5 EF6 |
No | No | Bulk Insert Batch Delete Batch Update Include Optimized |
EntityFramework.Extended | FREE | EF5 EF6 |
No | Yes | Audit Batch Delete Batch Update Cache Future |
ZZZ Projects