Пример #1
0
        /// <summary>
        /// Releases all resource used by the <see cref="T:Ceen.Httpd.Handler.Login.DatabaseStorageModule"/> object.
        /// </summary>
        /// <remarks>Call <see cref="Dispose"/> when you are finished using the
        /// <see cref="T:Ceen.Httpd.Handler.Login.DatabaseStorageModule"/>. The <see cref="Dispose"/> method leaves the
        /// <see cref="T:Ceen.Httpd.Handler.Login.DatabaseStorageModule"/> in an unusable state. After calling
        /// <see cref="Dispose"/>, you must release all references to the
        /// <see cref="T:Ceen.Httpd.Handler.Login.DatabaseStorageModule"/> so the garbage collector can reclaim the memory
        /// that the <see cref="T:Ceen.Httpd.Handler.Login.DatabaseStorageModule"/> was occupying.</remarks>
        public void Dispose()
        {
            foreach (var f in this.GetType().GetFields(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance))
            {
                if (typeof(System.Data.IDbCommand).IsAssignableFrom(f.FieldType))
                {
                    try { ((System.Data.IDbCommand)f.GetValue(this)).Dispose(); }
                    catch { }
                }
            }

            if (m_connection != null)
            {
                m_connection.ReleaseDialect();
                m_connection.Dispose();
                m_connection = null;
            }
        }