Search code examples
c#mysqlentity-framework-corepomelo-entityframeworkcore-mysqlresiliency

Resiliency during SaveChanges in EntityFrameworkCore


I want to ensure that when I do a context.SaveChanges(), this is retried because the database might be temporarily down.

So far all I've found involves writing a lot of code that I'd then need to maintain, so is there something ready, an out-of-the-box tool, that I can use for resiliency?


Solution

  • I've created a small library called ResilientSaveChanges.EFCore that allows resilient context.SaveChanges / SaveChangesAsync in Entity Framework Core, logging of long-running transactions and limiting of concurrent SaveChanges. It's straight to the point.

    Available on GitHub and NuGet. Tried and tested in production on multiple private projects.