Ejemplo n.º 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; }
            }
        }
Ejemplo n.º 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; }
            }
        }
Ejemplo n.º 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; }
            }
        }