public async Task <QueryResult <List <T> > > Handle(GetEntitiesQuery <T> request, CancellationToken cancellationToken) { var stopwatch = new Stopwatch(); stopwatch.Start(); System.Linq.Expressions.Expression <Func <T, bool> > expression; if (request.Expression != null) { expression = request.Expression; } else { expression = (s) => true; } var entities = (await _entitiesRepository.GetAsync <T>(expression, request.Exclusions, request.Sort, request.Size, request.Page)).ToList(); stopwatch.Stop(); return(new QueryResult <List <T> >() { Result = entities, Count = _entitiesRepository.Count <T>(expression), ElapsedMs = stopwatch.ElapsedMilliseconds }); }
public Task <IEnumerable <TEntity> > Handle(GetEntitiesQuery <TEntity> request, CancellationToken cancellationToken) { return(Task.FromResult(_svc.GetAll())); }