DynamicWhere.ex
DynamicWhere.exv2.1.0·docs

SegmentResult<T>

SegmentResult<T> is the return shape of ToListAsyncSegment. It inherits every property from FilterResult<T> — there are no additional members. The separate type exists only to distinguish results that came from a segment query (UNION / INTERSECT / EXCEPT) from those that came from a plain filter.

Inherited properties

PropertyTypeDescription
PageNumberintCurrent page (0 when no pagination).
PageSizeintPage size (0 when no pagination).
PageCountintTotal pages.
TotalCountintTotal matching records (across all combined sets).
DataList<T>The result entities — already de-duplicated by the set operations.
QueryStringstring?Generated SQL (when getQueryString: true is passed).
Note
Because SegmentResult<T> inherits FilterResult<T>, any helper or extension you write against the base type works for both.

C# usage

SegmentResult<Customer> result = await dbContext.Customers.ToListAsyncSegment(segment);

Console.WriteLine($"page {result.PageNumber} of {result.PageCount}");
Console.WriteLine($"{result.TotalCount} total matches");

foreach (var customer in result.Data)
{
    Console.WriteLine($"- {customer.Name}");
}

JSON response example

{
  "pageNumber": 1,
  "pageSize": 50,
  "pageCount": 3,
  "totalCount": 124,
  "data": [
    { "id": 7, "name": "John Doe" },
    { "id": 12, "name": "Aisha Khan" }
  ],
  "queryString": null
}

See also