public void Relational_Store_Updates_range_of_records_with_serial_id()
        {
            var PropertyStore = new SqliteRelationalStore <Property>(_db);
            var myBatch       = new List <Property>();
            int qtyToAdd      = 10;

            for (int i = 1; i <= qtyToAdd; i++)
            {
                myBatch.Add(new Property {
                    Name = "John's Luxury Townhomes" + i, Address = i + " Property Parkway, Portland, OR 97204"
                });
            }
            PropertyStore.Add(myBatch);

            // Re-load, and update:
            var companies = PropertyStore.TryLoadData();

            for (int i = 0; i < qtyToAdd; i++)
            {
                companies.ElementAt(i).Name = "John's Low-Rent Brick Homes " + i;
            }
            PropertyStore.Update(companies);

            // Reload, and check updated names:
            companies = PropertyStore.TryLoadData().Where(c => c.Name.Contains("Low-Rent")).ToList();
            Assert.IsTrue(companies.Count == qtyToAdd);
        }
        public void Relational_Store_Updates_range_of_records_with_name_attributes()
        {
            var WorkOrderStore = new SqliteRelationalStore <WorkOrder>(_db);
            var myBatch        = new List <WorkOrder>();
            int qtyToAdd       = 10;

            for (int i = 1; i <= qtyToAdd; i++)
            {
                var newWorkOrder = new WorkOrder {
                    Description = "Caulk Tub " + i
                };
                myBatch.Add(newWorkOrder);
            }
            WorkOrderStore.Add(myBatch);

            // Re-load, and update:
            var workOrders = WorkOrderStore.TryLoadData();

            for (int i = 0; i < qtyToAdd; i++)
            {
                workOrders.ElementAt(i).Description = "Updated Tubs" + i;
            }
            WorkOrderStore.Update(workOrders);

            // Reload, and check updated names:
            workOrders = WorkOrderStore.TryLoadData().Where(c => c.Description.Contains("Updated")).ToList();
            Assert.IsTrue(workOrders.Count == qtyToAdd);
        }
Exemplo n.º 3
0
        public void Relational_Store_Updates_range_of_records_with_string_id()
        {
            var BuildingStore = new SqliteRelationalStore <Building>(_db);
            var myBatch       = new List <Building>();
            int qtyToAdd      = 10;

            for (int i = 1; i <= qtyToAdd; i++)
            {
                var newBuilding = new Building {
                    BIN = "OR13-" + i, Identifier = "Building " + i, PropertyId = i
                };
                myBatch.Add(newBuilding);
            }
            BuildingStore.Add(myBatch);

            // Re-load, and update:
            var buildings = BuildingStore.TryLoadData();

            for (int i = 0; i < qtyToAdd; i++)
            {
                buildings.ElementAt(i).Identifier = "Updated Building " + i;
            }
            BuildingStore.Update(buildings);

            // Reload, and check updated names:
            buildings = BuildingStore.TryLoadData().Where(c => c.Identifier.Contains("Updated")).ToList();
            Assert.IsTrue(buildings.Count == qtyToAdd);
        }
Exemplo n.º 4
0
        public void Relational_Store_Updates_range_of_records_with_pg_names()
        {
            var UnitStore = new SqliteRelationalStore <Unit>(_db);
            var myBatch   = new List <Unit>();
            int qtyToAdd  = 10;

            for (int i = 1; i <= qtyToAdd; i++)
            {
                var newUnit = new Unit {
                    BIN = "OR06-" + i, UnitNo = "D-10" + i
                };
                myBatch.Add(newUnit);
            }
            UnitStore.Add(myBatch);

            // Re-load, and update:
            var companies = UnitStore.TryLoadData();

            for (int i = 0; i < qtyToAdd; i++)
            {
                companies.ElementAt(i).UnitNo = "Updated-50" + i;
            }
            UnitStore.Update(companies);

            // Reload, and check updated names:
            companies = UnitStore.TryLoadData().Where(c => c.UnitNo.Contains("Updated")).ToList();
            Assert.IsTrue(companies.Count == qtyToAdd);
        }
    public void Relational_Store_Updates_record_with_pg_names() {
      var UnitStore = new SqliteRelationalStore<Unit>(_db);
      var newUnit = new Unit { BIN = "OR05-01", UnitNo = "C-101" };
      UnitStore.Add(newUnit);

      // Now go fetch the record again and update:
      string newName = "Updated-401";
      var foundUnit = UnitStore.TryLoadData().FirstOrDefault();
      foundUnit.UnitNo = newName;
      UnitStore.Update(foundUnit);
      Assert.IsTrue(foundUnit != null && foundUnit.UnitNo == newName);
    }
    public void Relational_Store_Updates_record_with_string_id() {
      var BuildingStore = new SqliteRelationalStore<Building>(_db);
      var newBuilding = new Building { BIN = "OR13-55", Identifier = "Building C", PropertyId = 1 };
      BuildingStore.Add(newBuilding);

      // Now go fetch the record again and update:
      string newIdentifier = "Updated Building C";
      var foundBuilding = BuildingStore.TryLoadData().FirstOrDefault();
      foundBuilding.Identifier = newIdentifier;
      BuildingStore.Update(foundBuilding);

      foundBuilding = BuildingStore.TryLoadData().FirstOrDefault(b => b.BIN == "OR13-55");
      Assert.IsTrue(foundBuilding != null && foundBuilding.Identifier == newIdentifier);
    }
    public void Relational_Store_Updates_record_with_name_attributes() {
      var WorkOrderStore = new SqliteRelationalStore<WorkOrder>(_db);
      var newWorkOrder = new WorkOrder { Description = "Snake toilet" };
      WorkOrderStore.Add(newWorkOrder);

      // Now go fetch the record again and update:
      string newValue = "Update: Call Roto-Rooter";
      var foundWorkOrder = WorkOrderStore.TryLoadData().FirstOrDefault();
      foundWorkOrder.Description = newValue;
      WorkOrderStore.Update(foundWorkOrder);

      foundWorkOrder = WorkOrderStore.TryLoadData().FirstOrDefault();
      Assert.IsTrue(foundWorkOrder != null && foundWorkOrder.Description == newValue);
    }
    public void Relational_Store_Updates_record_with_serial_id() {
      var PropertyStore = new SqliteRelationalStore<Property>(_db);
      var newProperty = new Property { Name = "John's Luxury Apartments", Address = "16 Property Parkway, Portland, OR 97204" };
      PropertyStore.Add(newProperty);

      // Now go fetch the record again and update:
      string newName = "John's Low-Rent Apartments";
      var foundProperty = PropertyStore.TryLoadData().FirstOrDefault();

      int idToFind = foundProperty.Id;
      foundProperty.Name = newName;
      PropertyStore.Update(foundProperty);
      foundProperty = PropertyStore.TryLoadData().FirstOrDefault(p => p.Id == idToFind);

      Assert.IsTrue(foundProperty != null && foundProperty.Name == newName);
    }
Exemplo n.º 9
0
        public void Relational_Store_Updates_record_with_pg_names()
        {
            var UnitStore = new SqliteRelationalStore <Unit>(_db);
            var newUnit   = new Unit {
                BIN = "OR05-01", UnitNo = "C-101"
            };

            UnitStore.Add(newUnit);

            // Now go fetch the record again and update:
            string newName   = "Updated-401";
            var    foundUnit = UnitStore.TryLoadData().FirstOrDefault();

            foundUnit.UnitNo = newName;
            UnitStore.Update(foundUnit);
            Assert.IsTrue(foundUnit != null && foundUnit.UnitNo == newName);
        }
        public void Relational_Store_Updates_record_with_name_attributes()
        {
            var WorkOrderStore = new SqliteRelationalStore <WorkOrder>(_db);
            var newWorkOrder   = new WorkOrder {
                Description = "Snake toilet"
            };

            WorkOrderStore.Add(newWorkOrder);

            // Now go fetch the record again and update:
            string newValue       = "Update: Call Roto-Rooter";
            var    foundWorkOrder = WorkOrderStore.TryLoadData().FirstOrDefault();

            foundWorkOrder.Description = newValue;
            WorkOrderStore.Update(foundWorkOrder);

            foundWorkOrder = WorkOrderStore.TryLoadData().FirstOrDefault();
            Assert.IsTrue(foundWorkOrder != null && foundWorkOrder.Description == newValue);
        }
Exemplo n.º 11
0
        public void Relational_Store_Updates_record_with_string_id()
        {
            var BuildingStore = new SqliteRelationalStore <Building>(_db);
            var newBuilding   = new Building {
                BIN = "OR13-55", Identifier = "Building C", PropertyId = 1
            };

            BuildingStore.Add(newBuilding);

            // Now go fetch the record again and update:
            string newIdentifier = "Updated Building C";
            var    foundBuilding = BuildingStore.TryLoadData().FirstOrDefault();

            foundBuilding.Identifier = newIdentifier;
            BuildingStore.Update(foundBuilding);

            foundBuilding = BuildingStore.TryLoadData().FirstOrDefault(b => b.BIN == "OR13-55");
            Assert.IsTrue(foundBuilding != null && foundBuilding.Identifier == newIdentifier);
        }
        public void Relational_Store_Updates_record_with_serial_id()
        {
            var PropertyStore = new SqliteRelationalStore <Property>(_db);
            var newProperty   = new Property {
                Name = "John's Luxury Apartments", Address = "16 Property Parkway, Portland, OR 97204"
            };

            PropertyStore.Add(newProperty);

            // Now go fetch the record again and update:
            string newName       = "John's Low-Rent Apartments";
            var    foundProperty = PropertyStore.TryLoadData().FirstOrDefault();

            int idToFind = foundProperty.Id;

            foundProperty.Name = newName;
            PropertyStore.Update(foundProperty);
            foundProperty = PropertyStore.TryLoadData().FirstOrDefault(p => p.Id == idToFind);

            Assert.IsTrue(foundProperty != null && foundProperty.Name == newName);
        }
    public void Relational_Store_Updates_range_of_records_with_name_attributes() {
      var WorkOrderStore = new SqliteRelationalStore<WorkOrder>(_db);
      var myBatch = new List<WorkOrder>();
      int qtyToAdd = 10;
      for (int i = 1; i <= qtyToAdd; i++) {
        var newWorkOrder = new WorkOrder { Description = "Caulk Tub " + i };
        myBatch.Add(newWorkOrder);
      }
      WorkOrderStore.Add(myBatch);

      // Re-load, and update:
      var workOrders = WorkOrderStore.TryLoadData();
      for (int i = 0; i < qtyToAdd; i++) {
        workOrders.ElementAt(i).Description = "Updated Tubs" + i;
      }
      WorkOrderStore.Update(workOrders);

      // Reload, and check updated names:
      workOrders = WorkOrderStore.TryLoadData().Where(c => c.Description.Contains("Updated")).ToList();
      Assert.IsTrue(workOrders.Count == qtyToAdd);
    }
    public void Relational_Store_Updates_range_of_records_with_pg_names() {
      var UnitStore = new SqliteRelationalStore<Unit>(_db);
      var myBatch = new List<Unit>();
      int qtyToAdd = 10;
      for (int i = 1; i <= qtyToAdd; i++) {
        var newUnit = new Unit { BIN = "OR06-" + i, UnitNo = "D-10" + i };
        myBatch.Add(newUnit);
      }
      UnitStore.Add(myBatch);

      // Re-load, and update:
      var companies = UnitStore.TryLoadData();
      for (int i = 0; i < qtyToAdd; i++) {
        companies.ElementAt(i).UnitNo = "Updated-50" + i;
      }
      UnitStore.Update(companies);

      // Reload, and check updated names:
      companies = UnitStore.TryLoadData().Where(c => c.UnitNo.Contains("Updated")).ToList();
      Assert.IsTrue(companies.Count == qtyToAdd);
    }
Exemplo n.º 15
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_Updates_range_of_records_with_string_id() {
      var BuildingStore = new SqliteRelationalStore<Building>(_db);
      var myBatch = new List<Building>();
      int qtyToAdd = 10;
      for (int i = 1; i <= qtyToAdd; i++) {
        var newBuilding = new Building { BIN = "OR13-" + i, Identifier = "Building " + i, PropertyId = i };
        myBatch.Add(newBuilding);
      }
      BuildingStore.Add(myBatch);

      // Re-load, and update:
      var buildings = BuildingStore.TryLoadData();
      for (int i = 0; i < qtyToAdd; i++) {
        buildings.ElementAt(i).Identifier = "Updated Building " + i;
      }
      BuildingStore.Update(buildings);

      // Reload, and check updated names:
      buildings = BuildingStore.TryLoadData().Where(c => c.Identifier.Contains("Updated")).ToList();
      Assert.IsTrue(buildings.Count == qtyToAdd);
    }
Exemplo n.º 17
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_Updates_range_of_records_with_serial_id() {
      var PropertyStore = new SqliteRelationalStore<Property>(_db);
      var myBatch = new List<Property>();
      int qtyToAdd = 10;
      for (int i = 1; i <= qtyToAdd; i++) {
        myBatch.Add(new Property { Name = "John's Luxury Townhomes" + i, Address = i + " Property Parkway, Portland, OR 97204" });
      }
      PropertyStore.Add(myBatch);

      // Re-load, and update:
      var companies = PropertyStore.TryLoadData();
      for (int i = 0; i < qtyToAdd; i++) {
        companies.ElementAt(i).Name = "John's Low-Rent Brick Homes " + i;
      }
      PropertyStore.Update(companies);

      // Reload, and check updated names:
      companies = PropertyStore.TryLoadData().Where(c => c.Name.Contains("Low-Rent")).ToList();
      Assert.IsTrue(companies.Count == qtyToAdd);
    }