/// <summary>
        ///
        /// </summary>
        /// <param name="disposing"></param>
        protected virtual void Dispose(bool disposing)
        {
            if (disposing && !disposed)
            {
                try
                {
                    cmd.Dispose();
                    cnn.Dispose();

                    if (mysqlTrans != null)
                    {
                        mysqlTrans.Dispose();
                    }
                }
                catch
                {
                }

                if (cnn.State == ConnectionState.Open)
                {
                    cnn.Close();
                }

                if (cnn != null)
                {
                    MySqlConnection.ClearPool(cnn);
                }

                components.Dispose();
            }

            disposed = true;
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="disposing"></param>
        protected virtual void Dispose(bool disposing)
        {
            // Check to see if Dispose has already been called.
            if (disposed)
            {
                return;
            }
            // If disposing equals true, dispose all managed
            // and unmanaged resources.
            if (disposing)
            {
                // Dispose managed resources.
                _component.Dispose();
            }

            // Call the appropriate methods to clean up
            // unmanaged resources here.
            // If disposing is false,
            // only the following code is executed.
            CloseHandle(_handle);
            _handle = IntPtr.Zero;

            // Note disposing has been done.
            disposed = true;
        }
Exemplo n.º 3
0
 //参数为true表示释放所有资源,只能由使用者调用
 //参数为false表示释放非托管资源,只能由垃圾回收器自动调用
 //如果子类有自己的非托管资源,可以重载这个函数,添加自己的非托管资源的释放
 //但是要记住,重载此函数必须保证调用基类的版本,以保证基类的资源正常释放
 protected virtual void Dispose(bool disposing)
 {
     if (!this.isDisposed)// 如果资源未释放 这个判断主要用了防止对象被多次释放
     {
         if (disposing)
         {
             comp.Dispose();// 释放托管资源
         }
     }
     this.isDisposed = true; // 标识此对象已释放
 }
Exemplo n.º 4
0
 protected virtual void Dispose(bool disposing)
 {
     if (!disposed)
     {
         if (disposing)
         {
             components.Dispose();
         }
         disposed = true;
     }
 }
Exemplo n.º 5
0
        public static bool _Dispose_System_ComponentModel_Component( )
        {
            //class object
            System.ComponentModel.Component _System_ComponentModel_Component = new System.ComponentModel.Component();

            //Parameters


            //Exception
            System.Exception exception_Real        = null;
            System.Exception exception_Intercepted = null;

            InterceptionMaintenance.disableInterception( );

            try
            {
                _System_ComponentModel_Component.Dispose();
            }

            catch (System.Exception e)
            {
                exception_Real = e;
            }


            InterceptionMaintenance.enableInterception( );

            try
            {
                _System_ComponentModel_Component.Dispose();
            }

            catch (System.Exception e)
            {
                exception_Intercepted = e;
            }


            return((exception_Real.Message == exception_Intercepted.Message));
        }
        public static bool _Dispose_System_ComponentModel_Component( )
        {
            //class object
            System.ComponentModel.Component _System_ComponentModel_Component = new System.ComponentModel.Component();

               //Parameters

               //Exception
               System.Exception exception_Real = null;
               System.Exception exception_Intercepted = null;

               InterceptionMaintenance.disableInterception( );

               try
               {
              _System_ComponentModel_Component.Dispose();
               }

               catch( System.Exception e )
               {
              exception_Real = e;
               }

               InterceptionMaintenance.enableInterception( );

               try
               {
              _System_ComponentModel_Component.Dispose();
               }

               catch( System.Exception e )
               {
              exception_Intercepted = e;
               }

               return( ( exception_Real.Message == exception_Intercepted.Message ));
        }