public void Delete(long id) { var blockStore = GetBlockStore(DefaultBlock); TEntity entity; var result = blockStore.TryRemove(id, out entity); AfterActionHandler?.Invoke(); }
public Task DeleteAllAsync() { return(Task.Run(() => { Store.Clear(); AfterActionHandler?.Invoke(); return true; })); }
public Task UpdateAsync(TEntity entity) { return(Task.Run(() => { var blockStore = this.GetBlockStore(DefaultBlock); blockStore.AddOrUpdate(GetId(entity), entity, (k, v) => entity); AfterActionHandler?.Invoke(); return true; })); }
public Task DeleteAsync(long id) { return(Task.Run(() => { TEntity entity; var blockStore = this.GetBlockStore(DefaultBlock); var result = blockStore.TryRemove(id, out entity); AfterActionHandler?.Invoke(); return result; })); }
public TEntity Add(TEntity entity) { var id = GenId(); SetEntityKeyValue(entity, id); var blockStore = GetBlockStore(DefaultBlock); blockStore.AddOrUpdate(id, entity, (k, v) => entity); AfterActionHandler?.Invoke(); return(blockStore[id]); }
public Task AddAsync(TEntity entity) { return(Task.Run(() => { var id = GenId(); SetEntityKeyValue(entity, id); var blockStore = this.GetBlockStore(DefaultBlock); blockStore.AddOrUpdate(id, entity, (k, v) => entity); AfterActionHandler?.Invoke(); return true; })); }
public TEntity Update(TEntity entity) { var id = GetId(entity); var blockStore = GetBlockStore(DefaultBlock); if (blockStore.ContainsKey(id)) { blockStore[id] = entity; } AfterActionHandler?.Invoke(); return(blockStore[id]); }
public void DeleteAll() { Store.Clear(); AfterActionHandler?.Invoke(); }