Пример #1
0
        public async Task <IEnumerable <RewriteRuleSummary> > ExecuteAsync(GetAllQuery <RewriteRuleSummary> query, IExecutionContext executionContext)
        {
            var rules = await _cache.GetOrAddAsync(() =>
            {
                return(Query().ToArrayAsync());
            });

            return(rules);
        }
Пример #2
0
        public async Task <ICollection <RewriteRuleSummary> > ExecuteAsync(GetAllRewriteRuleSummariesQuery query, IExecutionContext executionContext)
        {
            var rules = await _cache.GetOrAddAsync(async() =>
            {
                var dbResult = await Query().ToListAsync();
                var mapped   = dbResult
                               .Select(_rewriteRuleSummaryMapper.Map)
                               .ToList();

                return(mapped);
            });

            return(rules);
        }