public async Task InsertAsync(T entity) { entity.Created = ITimeService.Now; entity.AutoId = await IAutoIdService.GetNext <T>(); await IDatabaseService.InsertAsync(entity); await IEntityCacheService.SetAsync(entity); }
public async Task <T> GetByIdAsync(string id) { var result = await IEntityCacheService.GetByIdAsync <T>(id); if (result == null) { result = await IDatabaseService.GetByIdAsync <T>(id); if (result != null) { await IEntityCacheService.SetAsync(result); } } return(result); }
public async Task SaveAsync(T entity) { await IDatabaseService.SaveAsync(entity); await IEntityCacheService.SetAsync(entity); }