コード例 #1
0
        /// <summary>
        /// Commits this transaction.
        /// </summary>
        public void Commit()
        {
            if (DbTransaction != null)
            {
                try
                {
                    DbTransaction.Commit();

                    if (EntityTracker != null)
                    {
                        EntityTracker.AfterCompletion(true);
                    }
                }
                finally { DbTransaction = null; }
            }
        }
コード例 #2
0
        /// <summary>
        /// Roll back this transaction.
        /// </summary>
        public void Rollback()
        {
            if (DbTransaction != null)
            {
                try
                {
                    DbTransaction.Rollback();

                    if (EntityTracker != null)
                    {
                        EntityTracker.AfterCompletion(false);
                    }
                }
                finally { DbTransaction = null; }
            }
        }
コード例 #3
0
        /// <summary>
        /// Disposes of this Transaction instance and rolls back the active transaction if it is still active.
        /// </summary>
        public void Dispose()
        {
            if (DbTransaction != null)
            {
                try
                {
                    DbTransaction.Rollback();
                    Log.Error("Transaction: Transaction disposed without commit.");

                    if (EntityTracker != null)
                    {
                        EntityTracker.AfterCompletion(false);
                    }
                }
                finally { DbTransaction = null; }
            }
        }