DynamicWhere.ex
DynamicWhere.exv3.4.0·docs

SummaryResult

SummaryResult is the return shape of ToList<T>(Summary) and ToListAsync<T>(Summary). It mirrors FilterResult<T> except Data is a list of dynamic objects whose properties are the GroupBy.Fields with their dots removed, plus every AggregateBy.Alias exactly as sent.

Properties

PropertyTypeDescription
PageNumberintCurrent page (0 when no pagination).
PageSizeintPage size (0 when no pagination).
PageCountintTotal pages. 1 when the Summary carried no Page — an unpaged result is one page of everything — and 0 when nothing matched.
TotalCountintTotal grouped records.
DataList<dynamic>Dynamic objects with group keys + aggregation values.
QueryStringstring?Generated SQL (when getQueryString: true is passed).
PolicyPolicyTrace?What the policy layer did to this query. null unless the query went through ApplyPolicy. A guarded query sets it as DwPolicyOptions.IncludeTraceInResult decides: by default it is present under the convenience tier and null under the strict tier (since 3.1.0 — see breaking changes). The trace is always on PolicyQueryable<T>.LastTrace.
Changed in 3.1.0
An unpaged PageCount used to equal TotalCount: the calculation divided by a page size of 1 whenever none was sent, so a 200-group result reported 200 pages of one group each. It is now 1 — or 0 when there are no groups. PageNumber and PageSize are unchanged: both still 0 when no page was sent. The exception is a guarded query when the deployment sets DwCaps.DefaultPageSize, or the context declares a purpose with a default page of its own (3.4.0): the query is given page 1 at that size, and reports it.
Flattened alias keys
Each row in Data is a dynamic object whose top-level properties are the group keys plus the AggregateBy.Alias names. There is no nesting under "group" / "aggregates" — everything is flat, and a dotted group field loses its dots on the way out: Category.Name arrives as CategoryName.

C# usage

SummaryResult result = await dbContext.Orders.ToListAsync(summary);

foreach (dynamic row in result.Data)
{
    Console.WriteLine($"{row.Country}: {row.Total} orders, revenue {row.Revenue}");
}

JSON response example

Given a Summary grouping by Country with aliases Total (Count) and Revenue (Sumation of Amount):

{
  "pageNumber": 1,
  "pageSize": 20,
  "pageCount": 1,
  "totalCount": 3,
  "data": [
    { "Country": "IQ", "Total": 142, "Revenue": 28450.75 },
    { "Country": "SA", "Total": 98,  "Revenue": 19120.00 },
    { "Country": "AE", "Total": 31,  "Revenue":  6940.50 }
  ],
  "queryString": null,
  "policy": null
}

See also