public virtual void RollbackTransaction() { try { GetCurrentTransaction?.Rollback(); } finally { if (GetCurrentTransaction != null) { GetCurrentTransaction.Dispose(); GetCurrentTransaction = null; } } }
public virtual async Task CommitTransactionAsync() { try { await SaveEntitiesAsync(); GetCurrentTransaction?.Commit(); } catch { RollbackTransaction(); throw; } finally { if (GetCurrentTransaction != null) { GetCurrentTransaction.Dispose(); GetCurrentTransaction = null; } } }