예제 #1
0
        public virtual void RollbackTransaction()
        {
            try
            {
                GetCurrentTransaction?.Rollback();
            }
            finally
            {
                if (GetCurrentTransaction != null)
                {
                    GetCurrentTransaction.Dispose();

                    GetCurrentTransaction = null;
                }
            }
        }
예제 #2
0
        public virtual async Task CommitTransactionAsync()
        {
            try
            {
                await SaveEntitiesAsync();

                GetCurrentTransaction?.Commit();
            }
            catch
            {
                RollbackTransaction();

                throw;
            }
            finally
            {
                if (GetCurrentTransaction != null)
                {
                    GetCurrentTransaction.Dispose();

                    GetCurrentTransaction = null;
                }
            }
        }