/// <summary> /// Sample code that creates 50 tables and deletes 40 of them. /// Reads all the records of the leftover 10 tables. Intention of /// this example is to test table space recycling and to show to the /// user feature to delete a table in SOP. /// </summary> public void Run() { Console.WriteLine("{0}: CollectionRecycling demo started...", DateTime.Now); const int CollCount = 50; ITransaction Trans; IStoreFactory sf = new StoreFactory(); for (int i = 0; i < CollCount; i++) { string CollectionName = string.Format("People{0}", i); ISortedDictionary <long, Person> store = sf.Get <long, Person>(Server.SystemFile.Store, CollectionName); Trans = store.Transaction; if (store.Count == 0) { Populate(store); store.Flush(); //store.Dispose(); } //else // store.Dispose(); if (i >= 10) { //** get the table 5 tables "ago" store = sf.Get <long, Person>(Server.SystemFile.Store, string.Format("People{0}", i - 5)); //** delete the table retrieved... store.Delete(); } Trans.Commit(); server.BeginTransaction(); } for (int i = 0; i < CollCount; i++) { string CollectionName = string.Format("People{0}", i); ISortedDictionary <long, Person> store = sf.Get <long, Person>(Server.SystemFile.Store, CollectionName); if (store != null) { ReadAll(store); //store.Dispose(); } } Console.WriteLine("{0}: CollectionRecycling demo ended...", DateTime.Now); }