private void ReadDroppedTables() { lock (commitLock) { // The list of all dropped tables from the state file var tables = StateStore.GetDeleteList(); // For each visible table foreach (var resource in tables) { int tableId = resource.TableId; string tableName = resource.SourceName; // Load the master table from the resource information var source = LoadTableSource(tableId, tableName); // File wasn't found so remove from the delete resources if (source == null) { StateStore.RemoveDeleteResource(tableName); } else { source.Open(); // Add the table to the table list tableSources.Add(tableId, source); } } StateStore.Flush(); } }
private void CleanUp() { lock (commitLock) { if (IsClosed) { return; } // If no open transactions on the database, then clean up. if (Database.OpenTransactions == null || Database.OpenTransactions.Count == 0) { var deleteList = StateStore.GetDeleteList().ToArray(); if (deleteList.Length > 0) { int dropCount = 0; for (int i = deleteList.Length - 1; i >= 0; --i) { var tableName = deleteList[i].SourceName; CloseTable(tableName, true); } for (int i = deleteList.Length - 1; i >= 0; --i) { string tableName = deleteList[i].SourceName; bool dropped = CloseAndDropTable(tableName); // If we managed to drop the table, remove from the list. if (dropped) { StateStore.RemoveDeleteResource(tableName); ++dropCount; } } // If we dropped a table, commit an update to the conglomerate state. if (dropCount > 0) { StateStore.Flush(); } } } } }