Esempio n. 1
0
        protected virtual void Dispose(bool disposing)
        {
            // if we are pooling, then release ourselves
            if (connectionString.Pooling)
            {
                MySqlPoolManager.RemoveConnection(this);
            }

            isOpen = false;
        }
Esempio n. 2
0
        protected virtual void Dispose(bool disposing)
        {
            if (disposed)
            {
                return;
            }

            // Avoid cyclic calls to Dispose.
            disposed = true;
            try
            {
                ResetTimeout(1000);
                handler.Close(isOpen);
                // if we are pooling, then release ourselves
                if (connectionString.Pooling)
                {
                    MySqlPoolManager.RemoveConnection(this);
                }
            }
            catch (Exception ex)
            {
                if (disposing)
                {
                    MySqlException mysqlEx = ex as MySqlException;
                    if (mysqlEx == null)
                    {
                        MySqlTrace.LogError(0, ex.GetBaseException().Message);
                    }
                    else
                    {
                        MySqlTrace.LogError(mysqlEx.Number, ex.GetBaseException().Message);
                    }
                }
            }
            finally
            {
                reader = null;
                isOpen = false;
            }
        }