Esempio n. 1
0
        public DownloadRecord InitDownload(DownloadRecord downloadRecord)
        {
            lock (JsonStore)
            {
                var dRecords = new BiggyList <DownloadRecord>(JsonStore);
                var dr       = dRecords.FirstOrDefault(a => a.Url == downloadRecord.Url);
                if (dr == null)
                {
                    if (downloadRecord.DownloadItem == null)
                    {
                        downloadRecord.DownloadItem = new DownloadItem()
                        {
                            IsComplete = false
                        };
                    }
                    dRecords.Add(downloadRecord);
                    dr = downloadRecord;
                }
                else
                {
                    dr.IsCancelled = downloadRecord.IsCancelled;
                }

                dr.Hash = GetHashString(downloadRecord.Url);

                var finalFolder = EnsurePath(dr.Hash);
                var fullPath    = Path.Combine(finalFolder, dr.FileName);

                dr.FullPath = fullPath;

                dRecords.Update(dr);

                return(dr);
            }
        }
Esempio n. 2
0
        public void Biggylist_Updates_Range_Of_Items_In_Json_Store()
        {
            var propertyList = new BiggyList <Property>(_propertyStore);
            int initialCount = propertyList.Count;

            var myBatch  = new List <Property>();
            int qtyToAdd = 10;

            // This test uses an initial index value of 1 so taht there is a non-zero ID for the first item:
            for (int i = 1; i <= qtyToAdd; i++)
            {
                myBatch.Add(new Property {
                    Id = i, Name = "John's Luxury Townhomes" + i, Address = i + " Property Parkway, Portland, OR 97204"
                });
            }
            propertyList.Add(myBatch);

            // Just to be sure, reload from backing store and check what was added:
            propertyList = new BiggyList <Property>(_propertyStore);
            int addedCount = propertyList.Count;

            // Update each item:
            for (int i = 0; i < qtyToAdd; i++)
            {
                propertyList.ElementAt(i).Name = "John's Low-Rent Brick Homes " + i;
            }
            propertyList.Update(propertyList.ToList());

            // Reload, and check updated names:
            propertyList = new BiggyList <Property>(_propertyStore);
            var updatedItems = propertyList.Where(p => p.Name.Contains("Low-Rent Brick"));

            Assert.IsTrue(updatedItems.Count() == qtyToAdd);
        }
Esempio n. 3
0
        public void PurgeIncompletes()
        {
            lock (JsonStore)
            {
                var updateList = new List <DownloadRecord>();
                var dRecords   = new BiggyList <DownloadRecord>(JsonStore);
                foreach (var item in dRecords)
                {
                    if (item.DownloadItem == null)
                    {
                        continue;
                    }
                    if (item.DownloadItem.IsComplete)
                    {
                        continue;
                    }

                    if (item.DownloadItem.IsInProgress)
                    {
                        File.Delete(item.DownloadItem.FullPath);

                        item.DownloadItem = new DownloadItem()
                        {
                            IsComplete = false
                        };
                        updateList.Add(item);;
                    }
                }
                foreach (var item in updateList)
                {
                    dRecords.Update(item);
                }
            }
        }
Esempio n. 4
0
        public void Biggylist_Updates_Single_Item_In_Json_Store()
        {
            var propertyList = new BiggyList <Property>(_propertyStore);
            int initialCount = propertyList.Count;

            var newProperty = new Property {
                Id = 1, Name = "John's Luxury Apartments", Address = "2639 I St NW, Washington, D.C. 20037"
            };

            propertyList.Add(newProperty);

            int addedItemId = newProperty.Id;

            // Just to be sure, reload from backing store and check what was added:
            propertyList = new BiggyList <Property>(_propertyStore);
            var  addedProperty   = propertyList.FirstOrDefault(p => p.Id == addedItemId);
            bool isAddedProperly = addedProperty.Name.Contains("John's Luxury");

            // Now Update:
            string newName = "John's Low-Rent Apartments";

            addedProperty.Name = newName;
            propertyList.Update(addedProperty);

            // Go fetch again:
            propertyList  = new BiggyList <Property>(_propertyStore);
            addedProperty = propertyList.FirstOrDefault(p => p.Id == addedItemId);
            bool isUpdatedProperly = addedProperty.Name == newName;

            Assert.IsTrue(isAddedProperly && isUpdatedProperly);
        }
Esempio n. 5
0
    public void Biggylist_Updates_Single_Item_In_Json_Store() {
      var propertyList = new BiggyList<Property>(_propertyStore);
      int initialCount = propertyList.Count;

      var newProperty = new Property { Id = 1, Name = "John's Luxury Apartments", Address = "2639 I St NW, Washington, D.C. 20037" };
      propertyList.Add(newProperty);

      int addedItemId = newProperty.Id;

      // Just to be sure, reload from backing store and check what was added:
      propertyList = new BiggyList<Property>(_propertyStore);
      var addedProperty = propertyList.FirstOrDefault(p => p.Id == addedItemId);
      bool isAddedProperly = addedProperty.Name.Contains("John's Luxury");

      // Now Update:
      string newName = "John's Low-Rent Apartments";
      addedProperty.Name = newName;
      propertyList.Update(addedProperty);

      // Go fetch again:
      propertyList = new BiggyList<Property>(_propertyStore);
      addedProperty = propertyList.FirstOrDefault(p => p.Id == addedItemId);
      bool isUpdatedProperly = addedProperty.Name == newName;

      Assert.IsTrue(isAddedProperly && isUpdatedProperly);
    }
        public void Biggylist_Updates_Range_Of_Items_In_Sqlite_Store()
        {
            var PropertyDocumentList = new BiggyList <PropertyDocument>(_PropertyDocumentStore);
            int initialCount         = PropertyDocumentList.Count;

            var myBatch  = new List <PropertyDocument>();
            int qtyToAdd = 10;

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

            // Just to be sure, reload from backing store and check what was added:
            PropertyDocumentList = new BiggyList <PropertyDocument>(_PropertyDocumentStore);
            int addedCount = PropertyDocumentList.Count;

            // Update each item:
            for (int i = 0; i < qtyToAdd; i++)
            {
                PropertyDocumentList.ElementAt(i).Name = "John's Low-Rent Brick Homes " + i;
            }
            PropertyDocumentList.Update(PropertyDocumentList.ToList());

            // Reload, and check updated names:
            PropertyDocumentList = new BiggyList <PropertyDocument>(_PropertyDocumentStore);
            var updatedItems = PropertyDocumentList.Where(p => p.Name.Contains("Low-Rent Brick"));

            Assert.IsTrue(updatedItems.Count() == qtyToAdd);
        }
Esempio n. 7
0
        public void Updates_Item_With_OVerride_From_List_And_Store()
        {
            // Just in case:
            var overriddenClients = new BiggyList <Client>(new SQLServerStore <Client>(_hostDb));

            overriddenClients.Clear();

            // Add a new record:
            var newClient = new Client()
            {
                LastName = "Atten", FirstName = "John", Email = "*****@*****.**"
            };

            overriddenClients.Add(newClient);
            int newId = newClient.ClientId;

            // Update the same record-by-id with a new instance. OverrideClient overrides Equals with the id:
            var updateMe = new Client()
            {
                ClientId = newId, LastName = "Appleseed", FirstName = "John", Email = "*****@*****.**"
            };

            overriddenClients.Update(updateMe);

            // Open a new instance, to see if the item was added to the backing store as well:
            var altClientList = new BiggyList <Client>(new SQLServerStore <Client>(_connectionStringName));
            var updated       = altClientList.FirstOrDefault(c => c.LastName == "Appleseed");

            Assert.True(updated != null && updated.LastName == "Appleseed");
        }
Esempio n. 8
0
        public async Task <JsonResult <Status> > Update(string name)
        {
            var status = Status.Ok;

            try
            {
                Bitmap image;
                using (var requestStream = await Request.Content.ReadAsStreamAsync())
                    image = new Bitmap(requestStream);

                var page = _pages.SingleOrDefault(x => x.Name == name);

                if (page == null)
                {
                    _pages.Add(new PageModel {
                        Name = name, OriginalImagePath = _imageStore.Save(image, name + "." + Environment.OriginalId)
                    });
                }
                else if (!page.HumanComparisonRequired)
                {
                    page.ComparisonImagePath = _imageStore.Save(image, name + "." + Environment.ComparisonId);
                    await Task.Run(() => page.GenerateComparison());

                    _pages.Update(page);
                }
                else
                {
                    status = Status.HumanComparisonRequired;
                }
            }
            catch (Exception exception)
            {
                status = new Status
                {
                    Message = !exception.Message.IsNullOrEmpty() ? exception.Message : exception.InnerException.Message
                };
            }

            return(Json(status));
        }
Esempio n. 9
0
 public void Cancel(string url)
 {
     lock (JsonStore)
     {
         var dRecords = new BiggyList <DownloadRecord>(JsonStore);
         var item     = dRecords.FirstOrDefault(x => x.Url == url);
         if (item != null)
         {
             item.IsCancelled = true;
             dRecords.Update(item);
         }
     }
 }
Esempio n. 10
0
        //Update Serie
        public Serie UpdateSerie(Serie serie, out bool isUpdatedResult)
        {
            var serieUpdate = _serieList.SingleOrDefault(c => c.SerieId == serie.SerieId);

            serieUpdate.SerieName    = serie.SerieName.ToString();
            serieUpdate.SerieSeasson = serie.SerieSeasson;
            serieUpdate.SerieEpisode = serie.SerieEpisode;


            _serieList.Update(serieUpdate);
            Console.WriteLine("Saved------------------------------------------------------------------------");

            isUpdatedResult = true;
            return(serieUpdate);
        }
Esempio n. 11
0
        public void UpdateDownload(string url, DownloadItem downloadItem)
        {
            lock (JsonStore)
            {
                // This immediately load any existing artist documents from the json file:
                var dRecords = new BiggyList <DownloadRecord>(JsonStore);

                // This query never hits the disk - it uses LINQ directly in memory:
                var dr = dRecords.FirstOrDefault(a => a.Url == url);
                if (dr == null)
                {
                    //   throw new Exception(string.Format("Download record does not exit:[{0}]", url));
                    return;
                }
                dr.DownloadItem = downloadItem;
                dRecords.Update(dr);
            }
        }
Esempio n. 12
0
        public void UpdateCheckpoint(string checkpointToken)
        {
            var tenantCheckpoint = _tenantCheckpoints.SingleOrDefault(x => x.TenantId == _tenantId);

            if (tenantCheckpoint != null)
            {
                tenantCheckpoint.CheckpointToken = checkpointToken;

                _tenantCheckpoints.Update(tenantCheckpoint);
            }
            else
            {
                _tenantCheckpoints.Add(new TenantCheckpointTokenDocument
                {
                    TenantId        = _tenantId,
                    CheckpointToken = checkpointToken
                });
            }
        }
Esempio n. 13
0
        public void Updates_Item_In_List_And_Store_With_Equals_Override()
        {
            var overrideWidgetList = new BiggyList <OverrideWidget>(new JsonStore <OverrideWidget>());

            overrideWidgetList.Clear();
            overrideWidgetList.Add(new OverrideWidget {
                SKU = "001", Name = "Test widget 1", Price = 2.00M
            });

            var updatedItem = new OverrideWidget {
                SKU = "001", Name = "UPDATED", Price = 2.00M
            };

            overrideWidgetList.Update(updatedItem);

            // Reload the list:
            overrideWidgetList = new BiggyList <OverrideWidget>(new JsonStore <OverrideWidget>());

            // Grab from the list:
            var updatedInList = overrideWidgetList.FirstOrDefault(w => w.Name == "UPDATED");

            // Make sure updated in both:
            Assert.True(updatedInList.Name == "UPDATED");
        }
Esempio n. 14
0
 public void Update(User user)
 {
     user.SubmittedUrls = null;
     db.Update(user);
 }
Esempio n. 15
0
        public void Updates_Item_With_OVerride_From_List_And_Store()
        {
            // Just in case:
              var overriddenClients = new BiggyList<Client>(new SQLServerStore<Client>(_hostDb));
              overriddenClients.Clear();

              // Add a new record:
              var newClient = new Client() { LastName = "Atten", FirstName = "John", Email = "*****@*****.**" };
              overriddenClients.Add(newClient);
              int newId = newClient.ClientId;

              // Update the same record-by-id with a new instance. OverrideClient overrides Equals with the id:
              var updateMe = new Client() { ClientId = newId, LastName = "Appleseed", FirstName = "John", Email = "*****@*****.**" };

              overriddenClients.Update(updateMe);

              // Open a new instance, to see if the item was added to the backing store as well:
              var altClientList = new BiggyList<Client>(new SQLServerStore<Client>(_connectionStringName));
              var updated = altClientList.FirstOrDefault(c => c.LastName == "Appleseed");
              Assert.True(updated != null && updated.LastName == "Appleseed");
        }
Esempio n. 16
0
    public void Biggylist_Updates_Range_Of_Items_In_Json_Store() {
      var propertyList = new BiggyList<Property>(_propertyStore);
      int initialCount = propertyList.Count;

      var myBatch = new List<Property>();
      int qtyToAdd = 10;

      // This test uses an initial index value of 1 so taht there is a non-zero ID for the first item:
      for (int i = 1; i <= qtyToAdd; i++) {
        myBatch.Add(new Property { Id = i, Name = "John's Luxury Townhomes" + i, Address = i + " Property Parkway, Portland, OR 97204" });
      }
      propertyList.Add(myBatch);

      // Just to be sure, reload from backing store and check what was added:
      propertyList = new BiggyList<Property>(_propertyStore);
      int addedCount = propertyList.Count;

      // Update each item:
      for (int i = 0; i < qtyToAdd; i++) {
        propertyList.ElementAt(i).Name = "John's Low-Rent Brick Homes " + i;
      }
      propertyList.Update(propertyList.ToList());

      // Reload, and check updated names:
      propertyList = new BiggyList<Property>(_propertyStore);
      var updatedItems = propertyList.Where(p => p.Name.Contains("Low-Rent Brick"));
      Assert.IsTrue(updatedItems.Count() == qtyToAdd);
    }
Esempio n. 17
0
 public void Update(ShortenedUrl shortUrl)
 {
     db.Update(shortUrl);
 }
Esempio n. 18
0
        public static void Run()
        {
            var sw = new Stopwatch();
              Console.WriteLine("===========================================================");
              Console.WriteLine("Postgres - SOME FANCY QUERYING");
              Console.WriteLine("===========================================================");

              var _db = new PGCache(_connectionStringName);
              IBiggy<Artist> _artists;
              IBiggy<Album> _albums;
              IBiggy<Track> _tracks;

              Console.WriteLine("Loading up Artists from Chinook...");
              sw.Start();
              _artists = new BiggyList<Artist>(new PGStore<Artist>(_db));
              sw.Stop();
              Console.WriteLine("\tLoaded {0} Artist records in {1} ms", _artists.Count(), sw.ElapsedMilliseconds);

              Console.WriteLine("Loading up Albums from Chinook...");
              sw.Reset();
              sw.Start();
              _albums = new BiggyList<Album>(new PGStore<Album>(_db));
              sw.Stop();
              Console.WriteLine("\tLoaded {0} Albums in {1} ms", _artists.Count(), sw.ElapsedMilliseconds);

              Console.WriteLine("Loading up tracks from Chinook...");
              sw.Reset();
              sw.Start();
              _tracks = new BiggyList<Track>(new PGStore<Track>(_db));
              sw.Stop();
              Console.WriteLine("\tLoaded {0} Tracks in {1} ms", _tracks.Count(), sw.ElapsedMilliseconds);

              Console.WriteLine("Grab the record for AC/DC...");
              sw.Reset();
              sw.Start();
              var acdc = _artists.FirstOrDefault(a => a.Name == "AC/DC");
              sw.Stop();
              Console.WriteLine("\tFound AC/DC from memory in {0} ms", sw.ElapsedMilliseconds);

              Console.WriteLine("Find all the albums by AC/DC ...");
              sw.Reset();
              sw.Start();
              var acdcAlbums = _albums.Where(a => a.ArtistId == acdc.ArtistId);
              sw.Stop();
              Console.WriteLine("\tFound All {0} AC/DC albums from memory in {1} ms", acdcAlbums.Count(), sw.ElapsedMilliseconds);

              Console.WriteLine("Find all the Tracks from Albums by AC/DC ...");
              sw.Reset();
              sw.Start();
              var acdcTracks = from t in _tracks
                       join a in acdcAlbums on t.AlbumId equals a.AlbumId
                       select t;
              sw.Stop();
              Console.WriteLine("\tFound All {0} tracks by ACDC using in-memory JOIN in {1} ms:", acdcTracks.Count(), sw.ElapsedMilliseconds);
              foreach (var track in acdcTracks)
              {
            Console.WriteLine("\t-{0}", track.Name);
              }
              Console.WriteLine(Environment.NewLine);
              Console.WriteLine("===========================================================");
              Console.WriteLine("POSTGES - BASIC CRUD OPERATIONS");
              Console.WriteLine("===========================================================");

              IBiggy<Customer> _customers;

              sw.Reset();
              Console.WriteLine("Loading up customers from Chinook...");
              sw.Start();
              _customers = new BiggyList<Customer>(new PGStore<Customer>(_db));
              sw.Stop();
              Console.WriteLine("\tLoaded {0} records in {1}ms", _customers.Count(), sw.ElapsedMilliseconds);

              sw.Reset();
              Console.WriteLine("INSERTING a NEW Customer into Chinook...");
              var newCustomer = new Customer() { LastName = "Atten", FirstName = "John", Email = "*****@*****.**" };
              sw.Start();
              _customers.Add(newCustomer);
              sw.Stop();
              Console.WriteLine("\tWrote 1 record for a new count of {0} records in {1} ms", _customers.Count(), sw.ElapsedMilliseconds);

              sw.Reset();
              Console.WriteLine("UPDATING the new Customer record in Chinook...");
              newCustomer.FirstName = "Fred";
              sw.Start();
              _customers.Update(newCustomer);
              sw.Stop();
              Console.WriteLine("\tUpdated 1 record for a new count of {0} records in {1} ms", _customers.Count(), sw.ElapsedMilliseconds);

              sw.Reset();
              Console.WriteLine("DELETE the new Customer record in Chinook...");
              sw.Start();
              _customers.Remove(newCustomer);
              sw.Stop();
              Console.WriteLine("\tDeleted 1 record for a new count of {0} records in {1} ms", _customers.Count(), sw.ElapsedMilliseconds);

              Console.WriteLine(Environment.NewLine);
              Console.WriteLine("===========================================================");
              Console.WriteLine("POSTGES - BULK INSERTS AND DELETIONS");
              Console.WriteLine("===========================================================");

              Console.WriteLine("Creating Test Table...");
              if(_db.TableExists("client"))
              {
            _db.DropTable("client");
              }
              var columnDefs = new List<string>();
              columnDefs.Add("client_id serial PRIMARY KEY NOT NULL");
              columnDefs.Add("last_name Text NOT NULL");
              columnDefs.Add("first_name Text NOT NULL");
              columnDefs.Add("email Text NOT NULL");
              _db.CreateTable("client", columnDefs);

              IBiggy<Client> _clients;

              sw.Reset();
              int INSERT_QTY = 10000;
              Console.WriteLine("BULK INSERTING  {0} client records in Chinook...", INSERT_QTY);
              _clients = new BiggyList<Client>(new PGStore<Client>(_db));

              var inserts = new List<Client>();
              for (int i = 0; i < INSERT_QTY; i++)
              {
            inserts.Add(new Client() { LastName = string.Format("Atten {0}", i.ToString()), FirstName = "John", Email = "*****@*****.**" });
              }
              sw.Start();
              var inserted = _clients.Add(inserts);
              sw.Stop();
              Console.WriteLine("\tInserted {0} records in {1} ms", inserted.Count(), sw.ElapsedMilliseconds);

              sw.Reset();
              Console.WriteLine("Loading up Bulk inserted CLients from Chinook...");
              sw.Start();
              _clients = new BiggyList<Client>(new PGStore<Client>(_db));
              sw.Stop();
              Console.WriteLine("\tLoaded {0} records in {1}ms", _clients.Count(), sw.ElapsedMilliseconds);

              sw.Reset();
              Console.WriteLine("DELETING added records from Chinook...");
              var toRemove = _clients.Where(x => x.Email == "*****@*****.**");
              sw.Start();
              var removed = _clients.Remove(toRemove.ToList());
              sw.Stop();
              Console.WriteLine("\tDeleted {0} records in {1}ms", removed.Count(), sw.ElapsedMilliseconds);
        }
    public void Biggylist_Updates_Range_Of_Items_In_Sqlite_Store() {
      var PropertyDocumentList = new BiggyList<PropertyDocument>(_PropertyDocumentStore);
      int initialCount = PropertyDocumentList.Count;

      var myBatch = new List<PropertyDocument>();
      int qtyToAdd = 10;
      for (int i = 1; i <= qtyToAdd; i++) {
        myBatch.Add(new PropertyDocument { Name = "John's Luxury Townhomes" + i, Address = i + " PropertyDocument Parkway, Portland, OR 97204" });
      }
      PropertyDocumentList.Add(myBatch);

      // Just to be sure, reload from backing store and check what was added:
      PropertyDocumentList = new BiggyList<PropertyDocument>(_PropertyDocumentStore);
      int addedCount = PropertyDocumentList.Count;

      // Update each item:
      for (int i = 0; i < qtyToAdd; i++) {
        PropertyDocumentList.ElementAt(i).Name = "John's Low-Rent Brick Homes " + i;
      }
      PropertyDocumentList.Update(PropertyDocumentList.ToList());

      // Reload, and check updated names:
      PropertyDocumentList = new BiggyList<PropertyDocument>(_PropertyDocumentStore);
      var updatedItems = PropertyDocumentList.Where(p => p.Name.Contains("Low-Rent Brick"));
      Assert.IsTrue(updatedItems.Count() == qtyToAdd);
    }
Esempio n. 20
0
        public void Updates_Item_In_List_And_Store_With_Equals_Override()
        {
            var overrideWidgetList = new BiggyList<OverrideWidget>(new JsonStore<OverrideWidget>());
              overrideWidgetList.Clear();
              overrideWidgetList.Add(new OverrideWidget { SKU = "001", Name = "Test widget 1", Price = 2.00M });

              var updatedItem = new OverrideWidget { SKU = "001", Name = "UPDATED", Price = 2.00M };
              overrideWidgetList.Update(updatedItem);

              // Reload the list:
              overrideWidgetList = new BiggyList<OverrideWidget>(new JsonStore<OverrideWidget>());

              // Grab from the list:
              var updatedInList = overrideWidgetList.FirstOrDefault(w => w.Name == "UPDATED");

              // Make sure updated in both:
              Assert.True(updatedInList.Name == "UPDATED");
        }
Esempio n. 21
0
        public static void Run()
        {
            var sw = new Stopwatch();

            Console.WriteLine("===========================================================");
            Console.WriteLine("Postgres - SOME FANCY QUERYING");
            Console.WriteLine("===========================================================");


            var             _db = new PGCache(_connectionStringName);
            IBiggy <Artist> _artists;
            IBiggy <Album>  _albums;
            IBiggy <Track>  _tracks;

            Console.WriteLine("Loading up Artists from Chinook...");
            sw.Start();
            _artists = new BiggyList <Artist>(new PGStore <Artist>(_db));
            sw.Stop();
            Console.WriteLine("\tLoaded {0} Artist records in {1} ms", _artists.Count(), sw.ElapsedMilliseconds);


            Console.WriteLine("Loading up Albums from Chinook...");
            sw.Reset();
            sw.Start();
            _albums = new BiggyList <Album>(new PGStore <Album>(_db));
            sw.Stop();
            Console.WriteLine("\tLoaded {0} Albums in {1} ms", _artists.Count(), sw.ElapsedMilliseconds);


            Console.WriteLine("Loading up tracks from Chinook...");
            sw.Reset();
            sw.Start();
            _tracks = new BiggyList <Track>(new PGStore <Track>(_db));
            sw.Stop();
            Console.WriteLine("\tLoaded {0} Tracks in {1} ms", _tracks.Count(), sw.ElapsedMilliseconds);


            Console.WriteLine("Grab the record for AC/DC...");
            sw.Reset();
            sw.Start();
            var acdc = _artists.FirstOrDefault(a => a.Name == "AC/DC");

            sw.Stop();
            Console.WriteLine("\tFound AC/DC from memory in {0} ms", sw.ElapsedMilliseconds);


            Console.WriteLine("Find all the albums by AC/DC ...");
            sw.Reset();
            sw.Start();
            var acdcAlbums = _albums.Where(a => a.ArtistId == acdc.ArtistId);

            sw.Stop();
            Console.WriteLine("\tFound All {0} AC/DC albums from memory in {1} ms", acdcAlbums.Count(), sw.ElapsedMilliseconds);

            Console.WriteLine("Find all the Tracks from Albums by AC/DC ...");
            sw.Reset();
            sw.Start();
            var acdcTracks = from t in _tracks
                             join a in acdcAlbums on t.AlbumId equals a.AlbumId
                             select t;

            sw.Stop();
            Console.WriteLine("\tFound All {0} tracks by ACDC using in-memory JOIN in {1} ms:", acdcTracks.Count(), sw.ElapsedMilliseconds);
            foreach (var track in acdcTracks)
            {
                Console.WriteLine("\t-{0}", track.Name);
            }
            Console.WriteLine(Environment.NewLine);
            Console.WriteLine("===========================================================");
            Console.WriteLine("POSTGES - BASIC CRUD OPERATIONS");
            Console.WriteLine("===========================================================");

            IBiggy <Customer> _customers;


            sw.Reset();
            Console.WriteLine("Loading up customers from Chinook...");
            sw.Start();
            _customers = new BiggyList <Customer>(new PGStore <Customer>(_db));
            sw.Stop();
            Console.WriteLine("\tLoaded {0} records in {1}ms", _customers.Count(), sw.ElapsedMilliseconds);

            sw.Reset();
            Console.WriteLine("INSERTING a NEW Customer into Chinook...");
            var newCustomer = new Customer()
            {
                LastName = "Atten", FirstName = "John", Email = "*****@*****.**"
            };

            sw.Start();
            _customers.Add(newCustomer);
            sw.Stop();
            Console.WriteLine("\tWrote 1 record for a new count of {0} records in {1} ms", _customers.Count(), sw.ElapsedMilliseconds);

            sw.Reset();
            Console.WriteLine("UPDATING the new Customer record in Chinook...");
            newCustomer.FirstName = "Fred";
            sw.Start();
            _customers.Update(newCustomer);
            sw.Stop();
            Console.WriteLine("\tUpdated 1 record for a new count of {0} records in {1} ms", _customers.Count(), sw.ElapsedMilliseconds);

            sw.Reset();
            Console.WriteLine("DELETE the new Customer record in Chinook...");
            sw.Start();
            _customers.Remove(newCustomer);
            sw.Stop();
            Console.WriteLine("\tDeleted 1 record for a new count of {0} records in {1} ms", _customers.Count(), sw.ElapsedMilliseconds);


            Console.WriteLine(Environment.NewLine);
            Console.WriteLine("===========================================================");
            Console.WriteLine("POSTGES - BULK INSERTS AND DELETIONS");
            Console.WriteLine("===========================================================");

            Console.WriteLine("Creating Test Table...");
            if (_db.TableExists("client"))
            {
                _db.DropTable("client");
            }
            var columnDefs = new List <string>();

            columnDefs.Add("client_id serial PRIMARY KEY NOT NULL");
            columnDefs.Add("last_name Text NOT NULL");
            columnDefs.Add("first_name Text NOT NULL");
            columnDefs.Add("email Text NOT NULL");
            _db.CreateTable("client", columnDefs);

            IBiggy <Client> _clients;

            sw.Reset();
            int INSERT_QTY = 10000;

            Console.WriteLine("BULK INSERTING  {0} client records in Chinook...", INSERT_QTY);
            _clients = new BiggyList <Client>(new PGStore <Client>(_db));

            var inserts = new List <Client>();

            for (int i = 0; i < INSERT_QTY; i++)
            {
                inserts.Add(new Client()
                {
                    LastName = string.Format("Atten {0}", i.ToString()), FirstName = "John", Email = "*****@*****.**"
                });
            }
            sw.Start();
            var inserted = _clients.Add(inserts);

            sw.Stop();
            Console.WriteLine("\tInserted {0} records in {1} ms", inserted.Count(), sw.ElapsedMilliseconds);

            sw.Reset();
            Console.WriteLine("Loading up Bulk inserted CLients from Chinook...");
            sw.Start();
            _clients = new BiggyList <Client>(new PGStore <Client>(_db));
            sw.Stop();
            Console.WriteLine("\tLoaded {0} records in {1}ms", _clients.Count(), sw.ElapsedMilliseconds);


            sw.Reset();
            Console.WriteLine("DELETING added records from Chinook...");
            var toRemove = _clients.Where(x => x.Email == "*****@*****.**");

            sw.Start();
            var removed = _clients.Remove(toRemove.ToList());

            sw.Stop();
            Console.WriteLine("\tDeleted {0} records in {1}ms", removed.Count(), sw.ElapsedMilliseconds);
        }