Callback on SaveChanges in EFCore?
问题 I'm trying to do something like in my DbContext : public System.Action<IEnumerable<EntityEntry>> OnSave; public override int SaveChanges() { if(OnSave != null) OnSave(ChangeTracker.Entries()); return base.SaveChanges(); } Then DI (AutoFac) the DbContext into another class which can hook into the 'OnSave' function. I'm looking for a single source of truth when this happens. I don't think this will work or be reliable when DbContext is injected into multiple places since I'm pretty sure we end