public async Task <IEnumerable <EpcisEvent> > Fetch(CancellationToken cancellationToken) { _parameters.SetLimit(_limit ?? int.MaxValue); _query = _filters.ContainsFilters ? _query.Where(_filters.GetSqlFilters()) : _query; _query = _query.OrderBy($"{_orderField.ToPgSql()} {_orderDirection.ToPgSql()}"); using var reader = await _connection.QueryMultipleAsync(new CommandDefinition (_sqlTemplate.RawSql, _parameters.Values, cancellationToken : cancellationToken)); var eventDtoManager = await EventDtoManager.ReadAsync(reader, cancellationToken); return(eventDtoManager.FormatEvents()); }
public void OrderBy(EpcisField field, OrderDirection direction) => _query.OrderBy($"{field.ToPgSql()} {direction.ToPgSql()}");