Beispiel #1
0
 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(),
     });
 }
Beispiel #2
0
 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(),
         }));
     }
 }
Beispiel #3
0
 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));
     }
 }
Beispiel #4
0
        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);
            }
        }