예제 #1
0
파일: Driver.cs 프로젝트: tvrjcf/Demo
        protected virtual void Dispose(bool disposing)
        {
            // if we are pooling, then release ourselves
            if (connectionString.Pooling)
            {
                MySqlPoolManager.RemoveConnection(this);
            }

            isOpen = false;
        }
예제 #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;
            }
        }