Skip to main content

Query operations reference

The full query surface, documented.

Reference the operations, aliases, request shapes, and type guidance available through ServiceQuery®.

Flexible queries. Deliberate boundaries.

Response

One response shape for records, count metadata, and aggregates.

ServiceQueryResponse<T> returns the records from the query and exposes optional metadata when the request asks for it.

ServiceQuery response properties
PropertyTypeWhen it is populatedMeaning
ListList<T>Always initializedThe records returned by the executed query.
Countint?When IncludeCount() or the equivalent request option is usedThe total record count for the query.
Aggregatedouble?When an aggregate filter is includedThe aggregate result returned by the query.

Filtering

Build useful expressions from small operations.

The fluent builder and JSON request use the same underlying filter vocabulary. Use the aliases when constructing requests manually.

ServiceQuery filtering operations
CategoryOperationBuilder methodFilter typeAliasType guidance
GroupingBeginBeginExpression() or Begin()begin(Optional; use with complex predicates.
GroupingEndEndExpression() or End()end)Optional; use with complex predicates.
GroupingAndAnd()and&Required when combining multiple comparison filters.
GroupingOrOr()or|Required when combining multiple comparison filters.
ComparisonEqualIsEqual(property, value)equaleq, =String, numeric, date/time, Boolean, and nullable columns.
ComparisonNot equalIsNotEqual(property, value)notequal!=String, numeric, date/time, Boolean, and nullable columns.
ComparisonGreater thanIsGreaterThan(property, value)greaterthangt, >Numeric and date/time values, with nullable columns supported where the underlying comparison is valid.
ComparisonGreater than or equalIsGreaterThanOrEqual(property, value)greaterthanorequalgreaterthanequal, gtoe, gte, >=Numeric and date/time values, with nullable columns supported where the underlying comparison is valid.
ComparisonLess thanIsLessThan(property, value)lessthanlt, <Numeric and date/time values, with nullable columns supported where the underlying comparison is valid.
ComparisonLess than or equalIsLessThanOrEqual(property, value)lessthanorequallessthanequal, ltoe, lte, <=Numeric and date/time values, with nullable columns supported where the underlying comparison is valid.
ComparisonBetweenBetween(property, low, high)betweenNoneNumeric and date/time values. A null value is not a range operand.
TextContainsContains(property, value)containsNoneString values.
TextStarts withStartsWith(property, value)startswithswString values.
TextEnds withEndsWith(property, value)endswithewString values.
NullIs nullIsNull(property) or Null(property, true)isnullnullReference and nullable columns.
NullIs not nullIsNotNull(property) or Null(property, false)isnotnullnotnull, !nullReference and nullable columns.
SetIn setIsInSet(property, values) or Set(property, true, values)insetsetString, numeric, date/time, Boolean, and other supported scalar values.
SetNot in setIsNotInSet(property, values) or Set(property, false, values)notinsetnotset, !setString, numeric, date/time, Boolean, and other supported scalar values.

Sorting

Order the result without another endpoint convention.

Use the fluent builder for typed application code or the filter aliases when constructing a request directly.

ServiceQuery sorting operations
CategoryOperationBuilder methodFilter typeAliasType guidance
SortingAscendingSortAsc(property) or Sort(property, true)sortascsa, orderasc, oaString, numeric, date/time, Boolean, and nullable columns.
SortingDescendingSortDesc(property) or Sort(property, false)sortdescsd, orderdesc, odString, numeric, date/time, Boolean, and nullable columns.

Paging

Bound result size and request the metadata clients need.

Paging is expressed as request metadata rather than a property-specific filter.

ServiceQuery paging operations
CategoryOperationBuilder methodFilter typeAliasValue
PagingPage numberPaging(pageNumber, pageSize, includeCount)pagenumberpagenum, pnInteger page number.
PagingPage sizePaging(pageNumber, pageSize, includeCount)pagesizepsInteger result limit.
PagingInclude countPaging(pageNumber, pageSize, includeCount)includecounticBoolean response-count request.
PagingInclude count separatelyIncludeCount()includecounticRequests total-count metadata.

Aggregates

Ask for supported summaries without another endpoint.

Aggregate behavior depends on the value type and provider expression support. Numeric nullable columns remain valid for the supported numeric aggregates.

ServiceQuery aggregate operations
CategoryOperationBuilder methodFilter typeAliasType guidance
AggregateCountCount()countNoneCounts the query result; no property is required.
AggregateSumSum(property)sumNoneNumeric and nullable numeric columns.
AggregateAverageAverage(property)averageavgNumeric and nullable numeric columns.
AggregateMinimumMinimum(property)minimumminOrdered values such as numeric, string, date/time, and nullable columns where supported.
AggregateMaximumMaximum(property)maximummaxOrdered values such as numeric, string, date/time, and nullable columns where supported.

Result shaping

Control the shape and duplication of returned data.

Selection and distinctness change the result shape. They are separate from filtering, sorting, paging, and aggregation.

ServiceQuery result-shaping operations
CategoryOperationBuilder methodFilter typeAliasValue
Result shapingSelect propertiesSelect(params string[] propertyNames)selectselOne or more property names allowed by the API.
Result shapingDistinct resultsDistinct()distinctNoneRequests distinct result behavior for the supported query shape.

Type and provider guidance

The request model is shared. Expression support remains contextual.

These type families describe the normal query surface. Provider translation, API field policy, authorization, limits, and data classification remain separate boundaries.

ServiceQuery type-family guidance
Value familyFilteringSortingAggregatesNotes
StringEquality, text, setsAscending and descendingMinimum and maximum where supportedContains, StartsWith, and EndsWith are string operations.
NumericComparison, Between, setsAscending and descendingCount, Sum, Average, Minimum, MaximumNumeric ranges and aggregates remain provider-sensitive.
Date/timeComparison, Between, setsAscending and descendingMinimum and maximum where supportedBetween uses lower and upper date/time values.
BooleanEquality and supported setsProvider-supported orderingNot a numeric aggregate targetUse explicit API policy when exposing Boolean fields.
Nullable columnsUnderlying operations plus explicit null checksSupportedSupported for the applicable aggregateNull is not a Between operand. Use IsNull or IsNotNull for null semantics.

Provider compatibility is not identical behavior across every source. Verify the relevant expression, policy, and provider path for the API you own.

Same intent in code and JSON

Use the builder or send the structured request directly.

The API remains responsible for validating fields, applying authorization scope, enforcing limits, and selecting the queryable source.

Fluent C# builder

var request = new ServiceQueryRequestBuilder()
    .Contains("Name", "Ann")
    .Or()
    .Contains("Name", "Ben")
    .SortDesc("CreatedAt")
    .Paging(1, 25, true)
    .Select("Name", "Status")
    .Build();

Structured request

{
  "filters": [
    { "filterType": "contains", "properties": ["Name"], "values": ["Ann"] },
    { "filterType": "or" },
    { "filterType": "contains", "properties": ["Name"], "values": ["Ben"] },
    { "filterType": "sortdesc", "properties": ["CreatedAt"] },
    { "filterType": "pagenumber", "values": ["1"] },
    { "filterType": "pagesize", "values": ["25"] },
    { "filterType": "includecount", "values": ["true"] },
    { "filterType": "select", "properties": ["Name", "Status"] }
  ]
}

Inspect. Run. Adopt.

Start with the operation your API needs.

Review the request model, run the bounded demo, and decide where structured query power belongs in the API you already own.