MySql.Data.MySqlClient.MySqlConnection.CloseFully C# (CSharp) Method

CloseFully() private method

private CloseFully ( ) : void
return void
        internal void CloseFully()
        {
            if (settings.Pooling && driver.IsOpen)
            {
                // if we are in a transaction, roll it back
                if (driver.HasStatus(ServerStatusFlags.InTransaction))
                {
                    MySqlTransaction t = new MySqlTransaction(this, IsolationLevel.Unspecified);
                    t.Rollback();
                }

                MySqlPoolManager.ReleaseConnection(driver);
            }
            else
                driver.Close();
            driver = null;
        }

Usage Example

        public void Rollback(SinglePhaseEnlistment singlePhaseEnlistment)
        {
            // prevent commands in main thread to run concurrently
            Driver driver = connection.driver;

            lock (driver)
            {
                rollbackThreadId = Thread.CurrentThread.ManagedThreadId;
                while (connection.Reader != null)
                {
                    // wait for reader to finish. Maybe we should not wait
                    // forever and cancel it after some time?
                    System.Threading.Thread.Sleep(100);
                }
                simpleTransaction.Rollback();
                singlePhaseEnlistment.Aborted();
                DriverTransactionManager.RemoveDriverInTransaction(baseTransaction);

                driver.currentTransaction = null;

                if (connection.State == ConnectionState.Closed)
                {
                    connection.CloseFully();
                }
                rollbackThreadId = 0;
            }
        }
All Usage Examples Of MySql.Data.MySqlClient.MySqlConnection::CloseFully