public static QueryRequest ToQueryRequest(this ChartRequestModel request) { return(new QueryRequest { QueryName = request.QueryName, GroupResults = request.HasAggregates(), Columns = request.GetQueryColumns(), Filters = request.Filters, Orders = request.GetQueryOrders(), Pagination = request.MaxRows.HasValue ? new Pagination.Firsts(request.MaxRows.Value + 1) : new Pagination.All(), }); }
static ResultTable ExecuteChart <T>(ChartRequestModel request, DynamicQueryCore <T> dq) { using (ExecutionMode.UserInterface()) { return(dq.ExecuteQuery(new QueryRequest { GroupResults = request.HasAggregates(), QueryName = request.QueryName, Columns = request.GetQueryColumns(), Filters = request.Filters, Orders = request.GetQueryOrders(), Pagination = new Pagination.All(), })); } }
static async Task <ResultTable> ExecuteChartAsync <T>(ChartRequestModel request, DynamicQueryCore <T> dq, CancellationToken token) { using (ExecutionMode.UserInterface()) { return(await dq.ExecuteQueryAsync(new QueryRequest { GroupResults = request.HasAggregates(), QueryName = request.QueryName, Columns = request.GetQueryColumns(), Filters = request.Filters, Orders = request.GetQueryOrders(), Pagination = new Pagination.All(), }, token)); } }
static async Task <ResultTable> ExecuteChartAsync <T>(ChartRequestModel request, DynamicQueryCore <T> dq, CancellationToken token) { using (ExecutionMode.UserInterface()) { var result = await dq.ExecuteQueryAsync(new QueryRequest { GroupResults = request.HasAggregates(), QueryName = request.QueryName, Columns = request.GetQueryColumns(), Filters = request.Filters, Orders = request.GetQueryOrders(), Pagination = request.MaxRows.HasValue ? new Pagination.Firsts(request.MaxRows.Value + 1) : new Pagination.All(), }, token); if (request.MaxRows.HasValue && result.Rows.Length == request.MaxRows.Value) { throw new InvalidOperationException($"The chart request for ${request.QueryName} exceeded the max rows ({request.MaxRows})"); } return(result); } }