public virtual T Remove(T item) { if (_updateableBiggyStore != null) { _updateableBiggyStore.Remove(item); _luceneIndexer.DeleteDocumentFromIndex(item); } return(item); }
public virtual T Remove(T item) { _items.Remove(item); if (_updateableBiggyStore != null) { _updateableBiggyStore.Remove(item); } else { _store.SaveAll(_items); } return(item); }
public void Removes_Item_From_Store() { _widgets.Clear(); _widgets.Add(new Widget { SKU = "001", Name = "Test widget 1", Price = 2.00M }); var removeMe = _widgets.Load().FirstOrDefault(); _updateableWidgets.Remove(removeMe); var remainingWidgets = _widgets.Load(); Assert.True(remainingWidgets.Count() == 0); }
public virtual T Remove(T item) { _items.Remove(item); if (_store != null && !this.InMemory) { if (_updateableStore != null && !InMemory) { _updateableStore.Remove(item); } else { _store.SaveAll(_items); } } Fire(ItemRemoved, item: item); return(item); }
public void IUpdateableBiggyStore_Deletes_Many_Records() { _updateableStore = new SqlCeStore <Client>(_connectionStringName) as IUpdateableBiggyStore <Client>; 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); } _updateableStore.Add(insertThese); var newClients = _updateableStore.Load(); _updateableStore.Remove(newClients); newClients = _updateableStore.Load(); Assert.True(newClients.Count == 0); }
public void IUpdateableBiggyStore_Deletes_Record() { _updateableStore = new SqlCeStore <Client>(_connectionStringName) as IUpdateableBiggyStore <Client>; var newClient = new Client() { LastName = "Atten", FirstName = "John", Email = "*****@*****.**" }; _updateableStore.Add(newClient); // Stow the id so we can reload, then update (just to be SURE!!) int idToFind = newClient.ClientId; newClient = _updateableStore.Load().FirstOrDefault(c => c.ClientId == idToFind); var deleteMe = _updateableStore.Load().FirstOrDefault(c => c.ClientId == idToFind); _updateableStore.Remove(deleteMe); var clients = _updateableStore.Load(); Assert.True(clients.Count == 0); }
public void IUpdateableBiggyStore_Deletes_Many_Records() { _updateableStore = new PGStore<Client>(_connectionStringName) as IUpdateableBiggyStore<Client>; 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); } _updateableStore.Add(insertThese); var newClients = _updateableStore.Load(); _updateableStore.Remove(newClients); newClients = _updateableStore.Load(); Assert.True(newClients.Count == 0); }
public void IUpdateableBiggyStore_Deletes_Record() { _updateableStore = new PGStore<Client>(_connectionStringName) as IUpdateableBiggyStore<Client>; var newClient = new Client() { LastName = "Atten", FirstName = "John", Email = "*****@*****.**" }; _updateableStore.Add(newClient); // Stow the id so we can reload, then update (just to be SURE!!) int idToFind = newClient.ClientId; newClient = _updateableStore.Load().FirstOrDefault(c => c.ClientId == idToFind); var deleteMe = _updateableStore.Load().FirstOrDefault(c => c.ClientId == idToFind); _updateableStore.Remove(deleteMe); var clients = _updateableStore.Load(); Assert.True(clients.Count == 0); }