/// <summary> /// Remove the related records from ncache_db_sync table /// </summary> private void RemoveAllResources() { object[] tableInfo = { SYNC_TABLE, _cacheID }; lock (_oledbConPool) { OleDbConnection connection; IEnumerator em = _oledbConPool.Keys.GetEnumerator(); while (em.MoveNext()) { OleDbDataReader reader = null; OleDbCommand command; try { OleDbConnectionPool.SqlDbResourceInfo connInfo = (OleDbConnectionPool.SqlDbResourceInfo)_oledbConPool.GetResource((string)em.Current); connection = connInfo.Connection; command = connection.CreateCommand(); command.CommandText = string.Format(CultureInfo.InvariantCulture, "DELETE FROM {0} WHERE CACHE_ID = '{1}'", tableInfo); command.CommandType = CommandType.Text; reader = command.ExecuteReader(); } catch (Exception ex) { NCacheLog.Error(ex.ToString()); } finally { if (reader != null) { reader.Close(); reader.Dispose(); reader = null; } } } _oledbConPool.RemoveAllResources(); //clear the table for dependency count. _tblDepCount = null; } lock (_sqlConPool) { IDbConnection connection = null; IEnumerator em = _sqlConPool.Keys.GetEnumerator(); while (em.MoveNext()) { IDataReader reader = null; IDbCommand command = null; try { DbConnectionPool.DbResourceInfo connInfo = (DbConnectionPool.DbResourceInfo)_sqlConPool.GetResource((string)em.Current); connection = connInfo.Connection; command = connection.CreateCommand(); command.CommandText = string.Format(CultureInfo.InvariantCulture, "DELETE FROM {0} WHERE CACHE_ID = '{1}'", tableInfo); command.CommandType = CommandType.Text; reader = command.ExecuteReader(); } catch (Exception ex) { NCacheLog.Error(ex.ToString()); } finally { if (reader != null) { reader.Close(); reader.Dispose(); reader = null; } } } _sqlConPool.RemoveAllResources(); } }