예제 #1
0
 public BlogController(IBlogQuery blogQuery, IBlogService blogService)
 {
     _blogQuery   = blogQuery;
     _blogService = blogService;
 }
예제 #2
0
        async private Task <IEnumerable <PostRelated> > UseQuery(BlogDbContext context, IBlogQuery query)
        {
            var source = context.Set <PostRelated>().Include(p => p.Current)
                         .Where(x => x.Current.Id == Guid.Empty || (x.EndDate >= _clock.UtcNow.DateTime && x.StartDate <= _clock.UtcNow.DateTime));

            query.Get(source);
            var result = await source.ToListAsync();

            return(result.AsEnumerable());
        }
예제 #3
0
 public BlogController(IBlogQuery query, IBlogCommand command)
 {
     _query   = query;
     _command = command;
 }
예제 #4
0
 async public Task <object> Query(IBlogQuery query)
 => (await Query(async ctx => (await UseQuery(ctx, query)).AsEnumerable()))
 .ToFormat()
 .ToArray();
 async public Task <Blogs> GetBlogs(IBlogQuery query)
 => new Blogs(await query.Get(_context).ToArrayAsync());