Search code examples
c#sql-updateentity-framework-6sql-insertsql-delete

Is there a non-commercial alternative to Z.EntityFramework.Extensions?


Entity Framework can be very slow on mass insert/update/delete operations. Even the often suggested tweaks to turn off AutoDetectChanges and/or ValidateOnSaveEnabled does not always help.

I have come across the Z.EntityFramework.Extensions on NuGet, but it seems to be a commercial product, which will only work for a certain period of time.

https://www.nuget.org/packages/Z.EntityFramework.Extensions/

So far, I really only need BulkInsert(), BulkUpdate() and BulkDelete().

My question is:

Is there any reliable non-commercial library, that does nearly the same as Z.EntityFramework.Extensions?

Thanks for any hints!


Solution

  • Disclaimer: I'm the owner of Entity Framework Extensions

    You are right. This is a commercial product.

    Every month, a free trial is available, but you will have to purchase the product for the production environment.

    Bulk Insert

    For BulkInsert, there are some free alternatives but be careful, they don't support all inheritances & associations and are no longer supported:

    Disclaimer: I'm the owner of Entity Framework Plus

    For Batch Update && Batch Delete, you can use this library:

    // DELETE all users which has been inactive for 2 years
    ctx.Users.Where(x => x.LastLoginDate < DateTime.Now.AddYears(-2))
             .Delete();
    
    // UPDATE all users which has been inactive for 2 years
    ctx.Users.Where(x => x.LastLoginDate < DateTime.Now.AddYears(-2))
             .Update(x => new User() { IsSoftDeleted = 1 });