Exemplo n.º 1
0
        public async Task InsertAsync(T entity)
        {
            entity.Created = ITimeService.Now;
            entity.AutoId  = await IAutoIdService.GetNext <T>();

            await IDatabaseService.InsertAsync(entity);

            await IEntityCacheService.SetAsync(entity);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        public async Task SaveAsync(T entity)
        {
            await IDatabaseService.SaveAsync(entity);

            await IEntityCacheService.SetAsync(entity);
        }