예제 #1
0
 public BiggyList(IBiggyStore <T> store)
 {
     _store                = store;
     _queryableStore       = _store as IQueryableBiggyStore <T>;
     _updateableBiggyStore = _store as IUpdateableBiggyStore <T>;
     _items                = _store.Load();
 }
예제 #2
0
 public LuceneStoreDecorator(IBiggyStore <T> biggyStore, bool useRamDirectory = false)
 {
     _biggyStore           = biggyStore;
     _queryableStore       = _biggyStore as IQueryableBiggyStore <T>;
     _updateableBiggyStore = _biggyStore as IUpdateableBiggyStore <T>;
     _luceneIndexer        = new LuceneIndexer <T>(useRamDirectory);
 }
예제 #3
0
        public PostgresStoreWithCompositePk()
        {
            var context = new PGCache(_connectionStringName);

            // Build a table to play with from scratch each time:
            if (context.TableExists("property"))
            {
                context.DropTable("property");
            }

            if (context.TableExists("building"))
            {
                context.DropTable("building");
            }

            var columnDefs = new List <string>();

            columnDefs.Add("property_id integer NOT NULL");
            columnDefs.Add("building_id integer NOT NULL");
            columnDefs.Add("name Text NOT NULL");
            columnDefs.Add("PRIMARY KEY (property_id, building_id)");
            context.CreateTable("building", columnDefs);

            var cache = new PGCache("chinookPG");

            _propertyStore = new PGStore <Property>(cache);
            _buildingStore = new PGStore <Building>(cache);
        }
예제 #4
0
 public void IBiggyStore_Adds_Record()
 {
     _biggyStore = new PGStore<Client>(_connectionStringName);
       var newClient = new Client() { LastName = "Atten", FirstName = "John", Email = "*****@*****.**" };
       _biggyStore.Add(newClient);
       Assert.True(newClient.ClientId > 0);
 }
예제 #5
0
        public SQLServerStoreWithCompositePk()
        {
            var context = new SQLServerCache("chinook");

            // Build a table to play with from scratch each time:
            if (context.TableExists("Property"))
            {
                context.DropTable("Property");
            }

            if (context.TableExists("Building"))
            {
                context.DropTable("Building");
            }

            var columnDefs = new List <string>();

            columnDefs.Add("PropertyId int NOT NULL");
            columnDefs.Add("BuildingId int NOT NULL");
            columnDefs.Add("Name Text NOT NULL");
            columnDefs.Add("PRIMARY KEY (PropertyId, BuildingId)");
            context.CreateTable("Building", columnDefs);

            _propertyStore = new SQLServerStore <Property>(context);
            _buildingStore = new SQLServerStore <Building>(context);
        }
예제 #6
0
        public BiggyListWithFileDb()
        {
            // Set up the store for injection:
            _widgets = new JsonStore <Widget>(dbName: "widgets");
            _widgets.Clear();

            _biggyWidgetList = new Biggy.BiggyList <Widget>(_widgets);
        }
예제 #7
0
        public BiggyListWithFileDb()
        {
            // Set up the store for injection:
              _widgets = new JsonStore<Widget>(dbName: "widgets");
              _widgets.Clear();

              _biggyWidgetList = new Biggy.BiggyList<Widget>(_widgets);
        }
예제 #8
0
파일: BiggyList.cs 프로젝트: grufffta/biggy
 public BiggyList(IBiggyStore <T> store, bool inMemory = false)
 {
     _store           = store;
     _queryableStore  = _store as IQueryableBiggyStore <T>;
     _updateableStore = _store as IUpdateableBiggyStore <T>;
     _items           = _store.Load();
     this.InMemory    = inMemory;
 }
예제 #9
0
        public BiggyListWithFileDb()
        {
            // Set up the store for injection:
              _widgets = new JsonStore<Widget>(dbName: "widgets");
              _updateableWidgets = _widgets as IUpdateableBiggyStore<Widget>;
              _queryableWidgets = _widgets as IQueryableBiggyStore<Widget>;
              _widgets.Clear();

              _biggyWidgetList = new Biggy.BiggyList<Widget>(_widgets);
        }
예제 #10
0
        public BiggyListWithFileDb()
        {
            // Set up the store for injection:
            _widgets           = new JsonStore <Widget>(dbName: "widgets");
            _updateableWidgets = _widgets as IUpdateableBiggyStore <Widget>;
            _queryableWidgets  = _widgets as IQueryableBiggyStore <Widget>;
            _widgets.Clear();

            _biggyWidgetList = new Biggy.BiggyList <Widget>(_widgets);
        }
예제 #11
0
 public BiggyList(bool inMemory = false)
 {
     // Unless the in-memory flag is set, initialize with JSON store:
     if (!inMemory)
     {
         _store = new JSON.JsonStore <T>();
     }
     _items        = (_store != null) ? _store.Load() : new List <T>();
     this.InMemory = inMemory;
 }
예제 #12
0
        public void IBiggyStore_Adds_Record()
        {
            _biggyStore = new SqlCeStore <Client>(_connectionStringName);
            var newClient = new Client()
            {
                LastName = "Atten", FirstName = "John", Email = "*****@*****.**"
            };

            _biggyStore.Add(newClient);
            Assert.True(newClient.ClientId > 0);
        }
예제 #13
0
        public void IBiggyStore_Adds_Many_Records()
        {
            _biggyStore = new PGStore<Client>(_connectionStringName);
              var insertThese = new List<Client>();

              for (int i = 0; i < 10; i++) {
            var newClient = new Client() { LastName = string.Format("LastName {0}", i), FirstName = "John", Email = "*****@*****.**" };
            insertThese.Add(newClient);
              }
              _biggyStore.Add(insertThese);
              var newClients = _biggyStore.Load();
              Assert.True(newClients.Count > 0);
        }
예제 #14
0
        public void Adds_Document_With_Serial_PK()
        {
            var newCustomer = new ClientDocument {
                Email     = "*****@*****.**",
                FirstName = "Rob",
                LastName  = "Conery"
            };

            IBiggyStore <ClientDocument> docStore = clientDocs as IBiggyStore <ClientDocument>;

            docStore.Add(newCustomer);
            docStore.Load();
            Assert.Equal(1, docStore.Load().Count());
        }
예제 #15
0
        public SqlCeDocumentStoreTest()
        {
            var context = new SqlCeCache(_connectionStringName);

              // Build a table to play with from scratch each time:
              if (context.TableExists("ClientDocuments")) {
            context.DropTable("ClientDocuments");
              }
              if (context.TableExists("MonkeyDocuments")) {
            context.DropTable("MonkeyDocuments");
              }
              clientDocs = new SqlCeDocumentStore<ClientDocument>(_connectionStringName);
              monkeyDocs = new SqlCeDocumentStore<MonkeyDocument>(_connectionStringName);
        }
예제 #16
0
        public SQLServerDocStoreCompositePk()
        {
            var cache = new SQLServerCache(_connectionStringName);

              // Build a table to play with from scratch each time:
              if (cache.TableExists("PropertyDocuments")) {
            cache.DropTable("PropertyDocuments");
              }
              if (cache.TableExists("BuildingDocuments")) {
            cache.DropTable("BuildingDocuments");
              }
              //propertyDocs = new SQLDocumentStore<PropertyDocument>(_connectionStringName);
              buildingDocs = new SQLDocumentStore<BuildingDocument>(_connectionStringName);
        }
예제 #17
0
        public PostgresDocumentStore()
        {
            _cache = new PGCache(_connectionStringName);

              // Build a table to play with from scratch each time:

              if (_cache.TableExists("ClientDocuments")) {
            _cache.DropTable("ClientDocuments");
              }
              if (_cache.TableExists("MonkeyDocuments")) {
            _cache.DropTable("MonkeyDocuments");
              }
              clientDocs = new PGDocumentStore<ClientDocument>(_connectionStringName);
              monkeyDocs = new PGDocumentStore<MonkeyDocument>(_connectionStringName);
        }
예제 #18
0
        public BiggyListWithFileDbInMemory()
        {
            // Set up the store for injection:
              _widgetStore = new JsonStore<Widget>(dbName: "widgets");
              _widgetStore.Clear();

              _biggyMemoryList = new Biggy.BiggyList<Widget>(_widgetStore);

              // Start with some data in a json file:
              var batch = new List<Widget>();
              for (int i = 0; i < INSERT_QTY; i++) {
            batch.Add(new Widget { SKU = string.Format("00{0}", i), Name = string.Format("Test widget {0}", i), Price = i });
              }
              _biggyMemoryList.Add(batch);
        }
예제 #19
0
        public SQLServerDocStoreCompositePk()
        {
            var cache = new SQLServerCache(_connectionStringName);

            // Build a table to play with from scratch each time:
            if (cache.TableExists("PropertyDocuments"))
            {
                cache.DropTable("PropertyDocuments");
            }
            if (cache.TableExists("BuildingDocuments"))
            {
                cache.DropTable("BuildingDocuments");
            }
            //propertyDocs = new SQLDocumentStore<PropertyDocument>(_connectionStringName);
            buildingDocs = new SQLDocumentStore <BuildingDocument>(_connectionStringName);
        }
예제 #20
0
        public PostgresDocStoreCompositePk()
        {
            var cache = new PGCache(_connectionStringName);

            // Build a table to play with from scratch each time:
            if (cache.TableExists("PropertyDocuments"))
            {
                cache.DropTable("\"PropertyDocuments\"");
            }
            if (cache.TableExists("BuildingDocuments"))
            {
                cache.DropTable("\"BuildingDocuments\"");
            }
            propertyDocs = new PGDocumentStore <PropertyDocument>(_connectionStringName);
            buildingDocs = new PGDocumentStore <BuildingDocument>(_connectionStringName);
        }
예제 #21
0
        public SqlCeDocumentStoreTest()
        {
            var context = new SqlCeCache(_connectionStringName);

            // Build a table to play with from scratch each time:
            if (context.TableExists("ClientDocuments"))
            {
                context.DropTable("ClientDocuments");
            }
            if (context.TableExists("MonkeyDocuments"))
            {
                context.DropTable("MonkeyDocuments");
            }
            clientDocs = new SqlCeDocumentStore <ClientDocument>(_connectionStringName);
            monkeyDocs = new SqlCeDocumentStore <MonkeyDocument>(_connectionStringName);
        }
예제 #22
0
        public PostgresDocumentStore()
        {
            _cache = new PGCache(_connectionStringName);

            // Build a table to play with from scratch each time:

            if (_cache.TableExists("ClientDocuments"))
            {
                _cache.DropTable("ClientDocuments");
            }
            if (_cache.TableExists("MonkeyDocuments"))
            {
                _cache.DropTable("MonkeyDocuments");
            }
            clientDocs = new PGDocumentStore <ClientDocument>(_connectionStringName);
            monkeyDocs = new PGDocumentStore <MonkeyDocument>(_connectionStringName);
        }
예제 #23
0
        public void IBiggyStore_Adds_Many_Records()
        {
            _biggyStore = new SqlCeStore <Client>(_connectionStringName);
            var insertThese = new List <Client>();

            for (int i = 0; i < 10; i++)
            {
                var newClient = new Client()
                {
                    LastName = string.Format("LastName {0}", i), FirstName = "John", Email = "*****@*****.**"
                };
                insertThese.Add(newClient);
            }
            _biggyStore.Add(insertThese);
            var newClients = _biggyStore.Load();

            Assert.True(newClients.Count > 0);
        }
예제 #24
0
        public PostgresDocumentStore()
        {
            var _cache = new PGCache(_connectionStringName);

            // Build a table to play with from scratch each time:

            // This needs a fix - gotta pass undelimited table name to one, and delimited to the other. FIX ME, DAMMIT!
            if (_cache.TableExists("ClientDocuments"))
            {
                _cache.DropTable("\"ClientDocuments\"");
            }
            if (_cache.TableExists("MonkeyDocuments"))
            {
                _cache.DropTable("\"MonkeyDocuments\"");
            }
            clientDocs = new PGDocumentStore <ClientDocument>(_connectionStringName);
            monkeyDocs = new PGDocumentStore <MonkeyDocument>(_connectionStringName);
        }
예제 #25
0
        public BiggyListWithSQL()
        {
            _hostDb = new SQLServerCache("chinook");
              // Build a table to play with from scratch each time:
              if (_hostDb.TableExists("Client")) {
            _hostDb.DropTable("Client");
              }

              var columnDefs = new List<string>();
              columnDefs.Add("ClientId int IDENTITY(1,1) PRIMARY KEY NOT NULL");
              columnDefs.Add("LastName Text NOT NULL");
              columnDefs.Add("FirstName Text NOT NULL");
              columnDefs.Add("Email Text NOT NULL");
              _hostDb.CreateTable("Client", columnDefs);

              _clientStore = new SQLServerStore<Client>(_hostDb);
              _clients = new BiggyList<Client>(_clientStore);
        }
예제 #26
0
        public BiggyListWithFileDbInMemory()
        {
            // Set up the store for injection:
            _widgetStore = new JsonStore <Widget>(dbName: "widgets");
            _widgetStore.Clear();

            _biggyMemoryList = new Biggy.BiggyList <Widget>(_widgetStore);

            // Start with some data in a json file:
            var batch = new List <Widget>();

            for (int i = 0; i < INSERT_QTY; i++)
            {
                batch.Add(new Widget {
                    SKU = string.Format("00{0}", i), Name = string.Format("Test widget {0}", i), Price = i
                });
            }
            _biggyMemoryList.Add(batch);
        }
예제 #27
0
        public BiggyListWithSQL()
        {
            _hostDb = new SQLServerCache("chinook");
            // Build a table to play with from scratch each time:
            if (_hostDb.TableExists("Client"))
            {
                _hostDb.DropTable("Client");
            }

            var columnDefs = new List <string>();

            columnDefs.Add("ClientId int IDENTITY(1,1) PRIMARY KEY NOT NULL");
            columnDefs.Add("LastName Text NOT NULL");
            columnDefs.Add("FirstName Text NOT NULL");
            columnDefs.Add("Email Text NOT NULL");
            _hostDb.CreateTable("Client", columnDefs);

            _clientStore = new SQLServerStore <Client>(_hostDb);
            _clients     = new BiggyList <Client>(_clientStore);
        }
예제 #28
0
        public void IBiggyDocumentStore_Add_A_Lot_Of_Records()
        {
            _clientDocs = new SqlCeDocumentStore<ClientDocument>(_connectionStringName);
              int recordsCnt = 500;
              List<ClientDocument> clients = new List<ClientDocument>(500);
              foreach (var i in Enumerable.Range(0, recordsCnt)) {
            clients.Add(new ClientDocument {
              Email = "client" + i + "@domain.com",
              FirstName = "client#" + i,
              LastName = "last#" + i
            });
              }

              var result = _clientDocs.Add(clients);
              // check for Pks
              Assert.Equal(recordsCnt, result.Last().ClientDocumentId);

              var newList = _clientDocs.Load();
              Assert.Equal(recordsCnt, newList.Count);
        }
예제 #29
0
        public void IUpdateableBiggyStore_Deletes_Record()
        {
            _biggyStore = new SqlCeStore <Client>(_connectionStringName);
            var newClient = new Client()
            {
                LastName = "Atten", FirstName = "John", Email = "*****@*****.**"
            };

            _biggyStore.Add(newClient);

            // Stow the id so we can reload, then update (just to be SURE!!)
            int idToFind = newClient.ClientId;

            newClient = _biggyStore.Load().FirstOrDefault(c => c.ClientId == idToFind);

            var deleteMe = _biggyStore.Load().FirstOrDefault(c => c.ClientId == idToFind);

            _biggyStore.Remove(deleteMe);
            var clients = _biggyStore.Load();

            Assert.True(clients.Count == 0);
        }
예제 #30
0
        public void IUpdateableBiggyStore_Updates_Record()
        {
            _biggyStore = new SqlCeStore <Client>(_connectionStringName);
            var newClient = new Client()
            {
                LastName = "Atten", FirstName = "John", Email = "*****@*****.**"
            };

            _biggyStore.Add(newClient);

            // Stow the id so we can reload, then update (just to be SURE!!)
            int idToFind = newClient.ClientId;

            newClient           = _biggyStore.Load().FirstOrDefault(c => c.ClientId == idToFind);
            newClient.FirstName = "John Paul";
            newClient.LastName  = "Jones";
            _biggyStore.Update(newClient);

            var updatedClient = _biggyStore.Load().FirstOrDefault(c => c.ClientId == idToFind);

            Assert.True(updatedClient.LastName == "Jones");
        }
예제 #31
0
        public SQLServerStoreWithCompositePk()
        {
            _cache = new SQLServerCache("chinook");

              // Build a table to play with from scratch each time:
              if (_cache.TableExists("Property")) {
            _cache.DropTable("Property");
              }

              if (_cache.TableExists("Building")) {
            _cache.DropTable("Building");
              }

              var columnDefs = new List<string>();
              columnDefs.Add("PropertyId int NOT NULL");
              columnDefs.Add("BuildingId int NOT NULL");
              columnDefs.Add("Name Text NOT NULL");
              columnDefs.Add("PRIMARY KEY (PropertyId, BuildingId)");
              _cache.CreateTable("Building", columnDefs);

              _propertyStore = new SQLServerStore<Property>(_cache);
              _buildingStore = new SQLServerStore<Building>(_cache);
        }
예제 #32
0
        public void IBiggyDocumentStore_Add_A_Lot_Of_Records()
        {
            _clientDocs = new SqlCeDocumentStore <ClientDocument>(_connectionStringName);
            int recordsCnt = 500;
            List <ClientDocument> clients = new List <ClientDocument>(500);

            foreach (var i in Enumerable.Range(0, recordsCnt))
            {
                clients.Add(new ClientDocument {
                    Email     = "client" + i + "@domain.com",
                    FirstName = "client#" + i,
                    LastName  = "last#" + i
                });
            }

            var result = _clientDocs.Add(clients);

            // check for Pks
            Assert.Equal(recordsCnt, result.Last().ClientDocumentId);

            var newList = _clientDocs.Load();

            Assert.Equal(recordsCnt, newList.Count);
        }
예제 #33
0
        public PostgresStoreWithCompositePk()
        {
            var context = new PGCache(_connectionStringName);

              // Build a table to play with from scratch each time:
              if (context.TableExists("property")) {
            context.DropTable("property");
              }

              if (context.TableExists("building")) {
            context.DropTable("building");
              }

              var columnDefs = new List<string>();
              columnDefs.Add("property_id integer NOT NULL");
              columnDefs.Add("building_id integer NOT NULL");
              columnDefs.Add("name Text NOT NULL");
              columnDefs.Add("PRIMARY KEY (property_id, building_id)");
              context.CreateTable("building", columnDefs);

              var cache = new PGCache("chinookPG");
              _propertyStore = new PGStore<Property>(cache);
              _buildingStore = new PGStore<Building>(cache);
        }
예제 #34
0
파일: Store.cs 프로젝트: pottereric/biggy
 public Store()
 {
     _widgets = new JsonStore<Widget>(dbName: "widgets");
       _updateableWidgets = _widgets as IUpdateableBiggyStore<Widget>;
       _queryableWidgets = _widgets as IQueryableBiggyStore<Widget>;
 }
예제 #35
0
 public Storage()
 {
     settingStore = new JsonStore<Settings>(dbPath: HttpRuntime.AppDomainAppPath);
 }
예제 #36
0
파일: Store.cs 프로젝트: superted17/biggy
 public Store()
 {
     _widgets = new JsonStore <Widget>(dbName: "widgets");
 }
예제 #37
0
파일: Store.cs 프로젝트: WilJoey/biggy
 public Store()
 {
     _widgets = new JsonStore<Widget>(dbName: "widgets");
 }
예제 #38
0
 public BiggyList(IBiggyStore <T> store, bool inMemory = false)
 {
     _store        = store;
     _items        = (_store != null) ? _store.Load() : new List <T>();
     this.InMemory = inMemory;
 }
예제 #39
0
        public void IUpdateableBiggyStore_Deletes_Record()
        {
            _biggyStore = new PGStore<Client>(_connectionStringName);
              var newClient = new Client() { LastName = "Atten", FirstName = "John", Email = "*****@*****.**" };
              _biggyStore.Add(newClient);

              // Stow the id so we can reload, then update (just to be SURE!!)
              int idToFind = newClient.ClientId;
              newClient = _biggyStore.Load().FirstOrDefault(c => c.ClientId == idToFind);

              var deleteMe = _biggyStore.Load().FirstOrDefault(c => c.ClientId == idToFind);
              _biggyStore.Remove(deleteMe);
              var clients = _biggyStore.Load();
              Assert.True(clients.Count == 0);
        }
예제 #40
0
        public void IUpdateableBiggyStore_Updates_Record()
        {
            _biggyStore = new PGStore<Client>(_connectionStringName);
              var newClient = new Client() { LastName = "Atten", FirstName = "John", Email = "*****@*****.**" };
              _biggyStore.Add(newClient);

              // Stow the id so we can reload, then update (just to be SURE!!)
              int idToFind = newClient.ClientId;
              newClient = _biggyStore.Load().FirstOrDefault(c => c.ClientId == idToFind);
              newClient.FirstName = "John Paul";
              newClient.LastName = "Jones";
              _biggyStore.Update(newClient);

              var updatedClient = _biggyStore.Load().FirstOrDefault(c => c.ClientId == idToFind);
              Assert.True(updatedClient.LastName == "Jones");
        }
예제 #41
0
 public Storage(string Albumname)
 {
     settingStore = new JsonStore<Settings>(dbPath: HttpRuntime.AppDomainAppPath);
     albumStore = new JsonStore<Albums>(dbPath: HttpRuntime.AppDomainAppPath);
     AlbumList.Add(Albumname);
 }
예제 #42
0
 public Store()
 {
     _widgets           = new JsonStore <Widget>(dbName: "widgets");
     _updateableWidgets = _widgets as IUpdateableBiggyStore <Widget>;
     _queryableWidgets  = _widgets as IQueryableBiggyStore <Widget>;
 }