private SwitchPage LoadSwitchPage(int page) { lock (_thisLock) { if (_switchPages.ContainsKey(page)) { return(_switchPages[page]); } if (_dbfactory != null) { try { int from = page * NetworkObjectSerializer.PageSize + 1; int to = (page + 1) * NetworkObjectSerializer.PageSize; using (DbConnection connection = _dbfactory.CreateConnection()) { connection.ConnectionString = _connectionString; DbCommand command = _dbfactory.CreateCommand(); command.Connection = connection; command.CommandText = "select " + _dbNames.DbColName("FDB_OID") + "," + _dbNames.DbColName("STATE") + " from " + _nodeTableName + " where " + _dbNames.DbColName("SWITCH") + "=1 and " + _dbNames.DbColName("FDB_OID") + ">=" + from + " and " + _dbNames.DbColName("FDB_OID") + "<=" + to; connection.Open(); DbDataAdapter adapter = _dbfactory.CreateDataAdapter(); adapter.SelectCommand = command; DataTable tab = new DataTable(); adapter.Fill(tab); SwitchPage switchPage = new SwitchPage(); _switchPages.Add(page, switchPage); foreach (DataRow row in tab.Rows) { switchPage.Add(Convert.ToInt32(row["FDB_OID"]), Convert.ToBoolean(row["STATE"])); } connection.Close(); return(switchPage); } } catch { } } return(null); } }