public override int SaveChanges(bool acceptAllChangesOnSuccess) { using var transaction = TransactionExt.Begin(IsolationLevel.ReadCommitted); var changeLogs = GetChangeLogs(); var result = base.SaveChanges(acceptAllChangesOnSuccess); _outbox.Send(changeLogs); transaction.Complete(); return(result); }
public override async Task <int> SaveChangesAsync( bool acceptAllChanges, CancellationToken cancellation = default) { using var transaction = TransactionExt.BeginAsync(IsolationLevel.ReadCommitted); var changeLogs = GetChangeLogs(); var result = await base.SaveChangesAsync(acceptAllChanges, cancellation); await _outbox.SendAsync(changeLogs, cancellation); transaction.Complete(); return(result); }