public BiggyList(IBiggyStore <T> store) { _store = store; _queryableStore = _store as IQueryableBiggyStore <T>; _updateableBiggyStore = _store as IUpdateableBiggyStore <T>; _items = _store.Load(); }
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); }
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); }
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); }
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); }
public BiggyListWithFileDb() { // Set up the store for injection: _widgets = new JsonStore <Widget>(dbName: "widgets"); _widgets.Clear(); _biggyWidgetList = new Biggy.BiggyList <Widget>(_widgets); }
public BiggyListWithFileDb() { // Set up the store for injection: _widgets = new JsonStore<Widget>(dbName: "widgets"); _widgets.Clear(); _biggyWidgetList = new Biggy.BiggyList<Widget>(_widgets); }
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; }
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); }
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); }
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; }
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); }
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); }
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()); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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"); }
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); }
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); }
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); }
public Store() { _widgets = new JsonStore<Widget>(dbName: "widgets"); _updateableWidgets = _widgets as IUpdateableBiggyStore<Widget>; _queryableWidgets = _widgets as IQueryableBiggyStore<Widget>; }
public Storage() { settingStore = new JsonStore<Settings>(dbPath: HttpRuntime.AppDomainAppPath); }
public Store() { _widgets = new JsonStore <Widget>(dbName: "widgets"); }
public Store() { _widgets = new JsonStore<Widget>(dbName: "widgets"); }
public BiggyList(IBiggyStore <T> store, bool inMemory = false) { _store = store; _items = (_store != null) ? _store.Load() : new List <T>(); this.InMemory = inMemory; }
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); }
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"); }
public Storage(string Albumname) { settingStore = new JsonStore<Settings>(dbPath: HttpRuntime.AppDomainAppPath); albumStore = new JsonStore<Albums>(dbPath: HttpRuntime.AppDomainAppPath); AlbumList.Add(Albumname); }
public Store() { _widgets = new JsonStore <Widget>(dbName: "widgets"); _updateableWidgets = _widgets as IUpdateableBiggyStore <Widget>; _queryableWidgets = _widgets as IQueryableBiggyStore <Widget>; }