Tiraggo.Interfaces.tgTransactionScope.Rollback C# (CSharp) Method

Rollback() private method

Internal method, called if the "using" statement is left without calling scope.Complete()
private Rollback ( ) : void
return void
        private void Rollback()
        {
            if (false == this.root.hasRolledBack && this.root.count > 0)
            {
                this.root.hasRolledBack = true;

                foreach (Transaction tx in this.root.transactions.Values)
                {
                    IDbConnection cn = tx.sqlTx.Connection;

                    try
                    {
                        // It may look as though we are eating an exception here
                        // but this method is private and only called when we
                        // have already received an error, we don't want our cleanup
                        // code to cloud the issue.
                        cn = tx.sqlTx.Connection;

                        tx.sqlTx.Rollback();
                        tx.sqlTx.Dispose();
                    }
                    catch { }

                    tx.sqlTx = null;
                    tx.sqlCn = null;

                    if (cn != null && cn.State == ConnectionState.Open)
                    {
                        cn.Close();
                    }
                }

                this.root.transactions.Clear();
                this.root.count = 0;
            }
        }