public void Relational_Store_Deletes_range_of_records_with_name_attributes() { var WorkOrderStore = new PgRelationalStore <WorkOrder>(_db); var myBatch = new List <WorkOrder>(); int qtyToAdd = 10; for (int i = 0; i < qtyToAdd; i++) { var newWorkOrder = new WorkOrder { Description = "Kill mice dead " + i }; myBatch.Add(newWorkOrder); } WorkOrderStore.Add(myBatch); // Re-load from back-end: var workOrders = WorkOrderStore.TryLoadData(); int qtyAdded = workOrders.Count; // Select 5 for deletion: int qtyToDelete = 5; var deleteThese = workOrders.Where(c => c.WorkOrderId <= qtyToDelete); // Delete: WorkOrderStore.Delete(deleteThese); int remaining = WorkOrderStore.TryLoadData().Count; Assert.IsTrue(qtyAdded == qtyToAdd && remaining == qtyAdded - qtyToDelete); }
public void Relational_Store_Deletes_range_of_records_with_pg_names() { var UnitStore = new PgRelationalStore <Unit>(_db); var myBatch = new List <Unit>(); int qtyToAdd = 10; for (int i = 0; i < qtyToAdd; i++) { var newUnit = new Unit { BIN = "OR08-" + i, UnitNo = "F-10" + i }; myBatch.Add(newUnit); } UnitStore.Add(myBatch); // Re-load from back-end: var companies = UnitStore.TryLoadData(); int qtyAdded = companies.Count; // Select 5 for deletion: int qtyToDelete = 5; var deleteThese = companies.Where(c => c.UnitId <= qtyToDelete); // Delete: UnitStore.Delete(deleteThese); int remaining = UnitStore.TryLoadData().Count; Assert.IsTrue(qtyAdded == qtyToAdd && remaining == qtyAdded - qtyToDelete); }
public void Relational_Store_Deletes_range_of_records_with_string_id() { var BuildingStore = new PgRelationalStore <Building>(_db); var myBatch = new List <Building>(); int qtyToAdd = 10; for (int i = 0; i < qtyToAdd; i++) { var newBuilding = new Building { BIN = "OR400-" + i, Identifier = "Building " + i, PropertyId = i }; myBatch.Add(newBuilding); } BuildingStore.Add(myBatch); // Re-load from back-end: var buildings = BuildingStore.TryLoadData(); int qtyAdded = buildings.Count; // Select 5 for deletion: int qtyToDelete = 5; var deleteThese = new List <Building>(); for (int i = 0; i < qtyToDelete; i++) { deleteThese.Add(buildings.ElementAt(i)); } // Delete: BuildingStore.Delete(deleteThese); int remaining = BuildingStore.TryLoadData().Count; Assert.IsTrue(qtyAdded == qtyToAdd && remaining == qtyAdded - qtyToDelete); }
public void Relational_Store_Deletes_range_of_records_with_serial_id() { var PropertyStore = new PgRelationalStore <Property>(_db); var myBatch = new List <Property>(); int qtyToAdd = 10; for (int i = 0; i < qtyToAdd; i++) { myBatch.Add(new Property { Name = "Boardwalk " + i, Address = i + " Property Parkway, Portland, OR 97204" }); } PropertyStore.Add(myBatch); // Re-load from back-end: var companies = PropertyStore.TryLoadData(); int qtyAdded = companies.Count; // Select 5 for deletion: int qtyToDelete = 5; var deleteThese = companies.Where(c => c.Id <= qtyToDelete); // Delete: PropertyStore.Delete(deleteThese); int remaining = PropertyStore.TryLoadData().Count; Assert.IsTrue(qtyAdded == qtyToAdd && remaining == qtyAdded - qtyToDelete); }
public void Relational_Store_Deletes_record_with_name_attributes() { var WorkOrderStore = new PgRelationalStore <WorkOrder>(_db); var newWorkOrder = new WorkOrder { Description = "Eradicate bed bugs" }; WorkOrderStore.Add(newWorkOrder); // Load from back-end: var workOrders = WorkOrderStore.TryLoadData(); int qtyAdded = workOrders.Count; // Delete: var foundWorkOrder = workOrders.FirstOrDefault(); WorkOrderStore.Delete(foundWorkOrder); int remaining = WorkOrderStore.TryLoadData().Count; Assert.IsTrue(qtyAdded == 1 && remaining == 0); }
public void Relational_Store_Deletes_record_with_pg_names() { var UnitStore = new PgRelationalStore <Unit>(_db); var newUnit = new Unit { BIN = "OR07-01", UnitNo = "E-101" }; UnitStore.Add(newUnit); // Load from back-end: var companies = UnitStore.TryLoadData(); int qtyAdded = companies.Count; // Delete: var foundUnit = companies.FirstOrDefault(); UnitStore.Delete(foundUnit); int remaining = UnitStore.TryLoadData().Count; Assert.IsTrue(qtyAdded == 1 && remaining == 0); }
public void Relational_Store_Deletes_record_with_serial_id() { var PropertyStore = new PgRelationalStore <Property>(_db); var newProperty = new Property { Name = "John's High-End Apartments", Address = "16 Property Parkway, Portland, OR 97204" }; PropertyStore.Add(newProperty); // Load from back-end: var companies = PropertyStore.TryLoadData(); int qtyAdded = companies.Count; // Delete: var foundProperty = companies.FirstOrDefault(); PropertyStore.Delete(foundProperty); int remaining = PropertyStore.TryLoadData().Count; Assert.IsTrue(qtyAdded == 1 && remaining == 0); }
public void Relational_Store_Deletes_record_with_string_id() { var BuildingStore = new PgRelationalStore <Building>(_db); var newBuilding = new Building { BIN = "OR300-01", Identifier = "Building D", PropertyId = 1 }; BuildingStore.Add(newBuilding); // Load from back-end: var buildings = BuildingStore.TryLoadData(); int qtyAdded = buildings.Count; // Delete: var foundBuilding = buildings.FirstOrDefault(); BuildingStore.Delete(foundBuilding); int remaining = BuildingStore.TryLoadData().Count; Assert.IsTrue(qtyAdded == 1 && remaining == 0); }
public void Relational_Store_Deletes_record_with_string_id() { var BuildingStore = new PgRelationalStore<Building>(_db); var newBuilding = new Building { BIN = "OR300-01", Identifier = "Building D", PropertyId = 1 }; BuildingStore.Add(newBuilding); // Load from back-end: var buildings = BuildingStore.TryLoadData(); int qtyAdded = buildings.Count; // Delete: var foundBuilding = buildings.FirstOrDefault(); BuildingStore.Delete(foundBuilding); int remaining = BuildingStore.TryLoadData().Count; Assert.IsTrue(qtyAdded == 1 && remaining == 0); }
public void Relational_Store_Deletes_range_of_records_with_string_id() { var BuildingStore = new PgRelationalStore<Building>(_db); var myBatch = new List<Building>(); int qtyToAdd = 10; for (int i = 0; i < qtyToAdd; i++) { var newBuilding = new Building { BIN = "OR400-" + i, Identifier = "Building " + i, PropertyId = i }; myBatch.Add(newBuilding); } BuildingStore.Add(myBatch); // Re-load from back-end: var buildings = BuildingStore.TryLoadData(); int qtyAdded = buildings.Count; // Select 5 for deletion: int qtyToDelete = 5; var deleteThese = new List<Building>(); for (int i = 0; i < qtyToDelete; i++) { deleteThese.Add(buildings.ElementAt(i)); } // Delete: BuildingStore.Delete(deleteThese); int remaining = BuildingStore.TryLoadData().Count; Assert.IsTrue(qtyAdded == qtyToAdd && remaining == qtyAdded - qtyToDelete); }
public void Relational_Store_Deletes_record_with_serial_id() { var PropertyStore = new PgRelationalStore<Property>(_db); var newProperty = new Property { Name = "John's High-End Apartments", Address = "16 Property Parkway, Portland, OR 97204" }; PropertyStore.Add(newProperty); // Load from back-end: var companies = PropertyStore.TryLoadData(); int qtyAdded = companies.Count; // Delete: var foundProperty = companies.FirstOrDefault(); PropertyStore.Delete(foundProperty); int remaining = PropertyStore.TryLoadData().Count; Assert.IsTrue(qtyAdded == 1 && remaining == 0); }
public void Relational_Store_Deletes_range_of_records_with_serial_id() { var PropertyStore = new PgRelationalStore<Property>(_db); var myBatch = new List<Property>(); int qtyToAdd = 10; for (int i = 0; i < qtyToAdd; i++) { myBatch.Add(new Property { Name = "Boardwalk " + i, Address = i + " Property Parkway, Portland, OR 97204" }); } PropertyStore.Add(myBatch); // Re-load from back-end: var companies = PropertyStore.TryLoadData(); int qtyAdded = companies.Count; // Select 5 for deletion: int qtyToDelete = 5; var deleteThese = companies.Where(c => c.Id <= qtyToDelete); // Delete: PropertyStore.Delete(deleteThese); int remaining = PropertyStore.TryLoadData().Count; Assert.IsTrue(qtyAdded == qtyToAdd && remaining == qtyAdded - qtyToDelete); }
public void Run() { Console.WriteLine("Postgres Perf"); Console.WriteLine("============="); PgDropCreate.DropCreateAll(_pgDb); var pgStore = new PgRelationalStore<Artist>(_pgDb); var pgMemoryArtists = new List<Artist>(); var pgNewArtists = new List<Artist>(); for (int i = 1; i <= 10000; i++) { pgNewArtists.Add(new Artist { Name = "New Artist " + i }); } var sw = new System.Diagnostics.Stopwatch(); sw.Start(); pgStore.Add(pgNewArtists); sw.Stop(); Console.WriteLine("Added {0} new Artists in {1} ms", pgNewArtists.Count, sw.ElapsedMilliseconds); sw.Reset(); sw.Start(); var pgAllArtists = pgStore.TryLoadData(); sw.Stop(); Console.WriteLine("Read {0} Artists from DB in {1} ms", pgAllArtists.Count, sw.ElapsedMilliseconds); foreach (var artist in pgAllArtists) { artist.Name = "UPDATED"; } sw.Reset(); sw.Start(); pgStore.Update(pgAllArtists); sw.Stop(); Console.WriteLine("Updated {0} new Artists in {1} ms", pgAllArtists.Count, sw.ElapsedMilliseconds); sw.Reset(); sw.Start(); int pgHowMany = pgStore.Delete(pgAllArtists); sw.Stop(); Console.WriteLine("Delted {0} new Artists in {1} ms", pgHowMany, sw.ElapsedMilliseconds); Console.WriteLine("SQLite Perf"); Console.WriteLine("==========="); sqliteDropCreate.DropCreateAll(_sqlitedb); var sqliteStore = new SqliteRelationalStore<Artist>(_sqlitedb); var sqliteMemoryArtists = new List<Artist>(); var sqliteNewArtists = new List<Artist>(); for (int i = 1; i <= 10000; i++) { sqliteNewArtists.Add(new Artist { Name = "New Artist " + i }); } sw.Reset(); sw.Start(); sqliteStore.Add(sqliteNewArtists); sw.Stop(); Console.WriteLine("Added {0} new Artists in {1} ms", sqliteNewArtists.Count, sw.ElapsedMilliseconds); sw.Reset(); sw.Start(); var sqliteAllArtists = sqliteStore.TryLoadData(); sw.Stop(); Console.WriteLine("Read {0} Artists from DB in {1} ms", sqliteAllArtists.Count, sw.ElapsedMilliseconds); foreach (var artist in sqliteAllArtists) { artist.Name = "UPDATED"; } sw.Reset(); sw.Start(); sqliteStore.Update(sqliteAllArtists); sw.Stop(); Console.WriteLine("Updated {0} new Artists in {1} ms", sqliteAllArtists.Count, sw.ElapsedMilliseconds); sw.Reset(); sw.Start(); int sqliteHowMany = sqliteStore.Delete(sqliteAllArtists); sw.Stop(); Console.WriteLine("Delted {0} new Artists in {1} ms", sqliteHowMany, sw.ElapsedMilliseconds); }
public void Relational_Store_Deletes_range_of_records_with_name_attributes() { var WorkOrderStore = new PgRelationalStore<WorkOrder>(_db); var myBatch = new List<WorkOrder>(); int qtyToAdd = 10; for (int i = 0; i < qtyToAdd; i++) { var newWorkOrder = new WorkOrder { Description = "Kill mice dead " + i }; myBatch.Add(newWorkOrder); } WorkOrderStore.Add(myBatch); // Re-load from back-end: var workOrders = WorkOrderStore.TryLoadData(); int qtyAdded = workOrders.Count; // Select 5 for deletion: int qtyToDelete = 5; var deleteThese = workOrders.Where(c => c.WorkOrderId <= qtyToDelete); // Delete: WorkOrderStore.Delete(deleteThese); int remaining = WorkOrderStore.TryLoadData().Count; Assert.IsTrue(qtyAdded == qtyToAdd && remaining == qtyAdded - qtyToDelete); }
public void Relational_Store_Deletes_record_with_name_attributes() { var WorkOrderStore = new PgRelationalStore<WorkOrder>(_db); var newWorkOrder = new WorkOrder { Description = "Eradicate bed bugs" }; WorkOrderStore.Add(newWorkOrder); // Load from back-end: var workOrders = WorkOrderStore.TryLoadData(); int qtyAdded = workOrders.Count; // Delete: var foundWorkOrder = workOrders.FirstOrDefault(); WorkOrderStore.Delete(foundWorkOrder); int remaining = WorkOrderStore.TryLoadData().Count; Assert.IsTrue(qtyAdded == 1 && remaining == 0); }
public void Run() { Console.WriteLine("Postgres Perf"); Console.WriteLine("============="); PgDropCreate.DropCreateAll(_pgDb); var pgStore = new PgRelationalStore <Artist>(_pgDb); var pgMemoryArtists = new List <Artist>(); var pgNewArtists = new List <Artist>(); for (int i = 1; i <= 10000; i++) { pgNewArtists.Add(new Artist { Name = "New Artist " + i }); } var sw = new System.Diagnostics.Stopwatch(); sw.Start(); pgStore.Add(pgNewArtists); sw.Stop(); Console.WriteLine("Added {0} new Artists in {1} ms", pgNewArtists.Count, sw.ElapsedMilliseconds); sw.Reset(); sw.Start(); var pgAllArtists = pgStore.TryLoadData(); sw.Stop(); Console.WriteLine("Read {0} Artists from DB in {1} ms", pgAllArtists.Count, sw.ElapsedMilliseconds); foreach (var artist in pgAllArtists) { artist.Name = "UPDATED"; } sw.Reset(); sw.Start(); pgStore.Update(pgAllArtists); sw.Stop(); Console.WriteLine("Updated {0} new Artists in {1} ms", pgAllArtists.Count, sw.ElapsedMilliseconds); sw.Reset(); sw.Start(); int pgHowMany = pgStore.Delete(pgAllArtists); sw.Stop(); Console.WriteLine("Delted {0} new Artists in {1} ms", pgHowMany, sw.ElapsedMilliseconds); Console.WriteLine("SQLite Perf"); Console.WriteLine("==========="); sqliteDropCreate.DropCreateAll(_sqlitedb); var sqliteStore = new SqliteRelationalStore <Artist>(_sqlitedb); var sqliteMemoryArtists = new List <Artist>(); var sqliteNewArtists = new List <Artist>(); for (int i = 1; i <= 10000; i++) { sqliteNewArtists.Add(new Artist { Name = "New Artist " + i }); } sw.Reset(); sw.Start(); sqliteStore.Add(sqliteNewArtists); sw.Stop(); Console.WriteLine("Added {0} new Artists in {1} ms", sqliteNewArtists.Count, sw.ElapsedMilliseconds); sw.Reset(); sw.Start(); var sqliteAllArtists = sqliteStore.TryLoadData(); sw.Stop(); Console.WriteLine("Read {0} Artists from DB in {1} ms", sqliteAllArtists.Count, sw.ElapsedMilliseconds); foreach (var artist in sqliteAllArtists) { artist.Name = "UPDATED"; } sw.Reset(); sw.Start(); sqliteStore.Update(sqliteAllArtists); sw.Stop(); Console.WriteLine("Updated {0} new Artists in {1} ms", sqliteAllArtists.Count, sw.ElapsedMilliseconds); sw.Reset(); sw.Start(); int sqliteHowMany = sqliteStore.Delete(sqliteAllArtists); sw.Stop(); Console.WriteLine("Delted {0} new Artists in {1} ms", sqliteHowMany, sw.ElapsedMilliseconds); }
public void Relational_Store_Deletes_record_with_pg_names() { var UnitStore = new PgRelationalStore<Unit>(_db); var newUnit = new Unit { BIN = "OR07-01", UnitNo = "E-101" }; UnitStore.Add(newUnit); // Load from back-end: var companies = UnitStore.TryLoadData(); int qtyAdded = companies.Count; // Delete: var foundUnit = companies.FirstOrDefault(); UnitStore.Delete(foundUnit); int remaining = UnitStore.TryLoadData().Count; Assert.IsTrue(qtyAdded == 1 && remaining == 0); }
public void Relational_Store_Deletes_range_of_records_with_pg_names() { var UnitStore = new PgRelationalStore<Unit>(_db); var myBatch = new List<Unit>(); int qtyToAdd = 10; for (int i = 0; i < qtyToAdd; i++) { var newUnit = new Unit { BIN = "OR08-" + i, UnitNo = "F-10" + i }; myBatch.Add(newUnit); } UnitStore.Add(myBatch); // Re-load from back-end: var companies = UnitStore.TryLoadData(); int qtyAdded = companies.Count; // Select 5 for deletion: int qtyToDelete = 5; var deleteThese = companies.Where(c => c.UnitId <= qtyToDelete); // Delete: UnitStore.Delete(deleteThese); int remaining = UnitStore.TryLoadData().Count; Assert.IsTrue(qtyAdded == qtyToAdd && remaining == qtyAdded - qtyToDelete); }