Skip to content

QueryDto ​

Namespace: MJCZone.DapperMatic.AspNetCore.Models.Dtos

Assembly: MJCZone.DapperMatic.AspNetCore

Summary ​

/// Request model for querying tables or views with filtering, sorting, and pagination.

public

Contents ​

Constructors (1) | Methods (8) | Properties (15)

Constructors ​

QueryDto ​

csharp
QueryDto()

Methods ​

MethodSummary
GetOrderByPairsParses the OrderBy string into a list of column and direction pairs.
GetFilterConditionsParses the filter conditions into a structured format.
GetSelectColumnsGets the columns to select as a list.
FromQueryParametersCreates a QueryRequest from query string parameters.
GetType
ToString
Equals
GetHashCode

GetOrderByPairs ​

Parses the OrderBy string into a list of column and direction pairs.

csharp
List<(string, bool)> GetOrderByPairs()

Returns ​

Type: List<(string, bool)>

A list of column and direction pairs.

GetFilterConditions ​

Parses the filter conditions into a structured format.

csharp
List<FilterConditionDto> GetFilterConditions()

Returns ​

Type: List<FilterConditionDto>

A list of filter conditions.

GetSelectColumns ​

Gets the columns to select as a list.

csharp
List&lt;string&gt; GetSelectColumns()

Returns ​

Type: List&lt;string&gt;

A list of column names to select.

FromQueryParameters ​

Creates a QueryRequest from query string parameters.

csharp
QueryDto FromQueryParameters(string query)

Parameters ​

  • query (string) - The query collection from HTTP request.

Returns ​

Type: QueryDto

A QueryRequest instance populated from query parameters.

GetType ​

csharp
GetType()

ToString ​

csharp
ToString()

Equals ​

csharp
Equals()

GetHashCode ​

csharp
GetHashCode()

Properties ​

Take ​

Gets or sets the number of records to take. Default is 100, max is 1000.

Type: int?

Skip ​

Gets or sets the number of records to skip for pagination.

Type: int?

IncludeTotal ​

Gets or sets a value indicating whether to include the total count in the response.

Type: bool?

OrderBy ​

Gets or sets the order by clause. Format: "column1.asc,column2.desc"

Type: string?

Filters ​

Gets or sets the filter conditions. Dictionary where key is "column.operator" and value is the filter value. Supported operators: eq, neq, gt, gte, lt, lte, like, nlike, in, nin, isnull, notnull

Type: Dictionary&lt;string, string&gt;

Select ​

Gets or sets the columns to select. If null or empty, selects all columns (*). Format: "column1,column2,column3"

Type: string?

Filter ​

Gets or sets a condition as OData's <c>$filter</c> writes it, ANDed with Filters: <c>status eq 'open' and customer/country in ('FR', 'DE') or lines/any(l: l/qty gt 5)</c>. Relations must be declared in <c>DapperMaticOptions.Relations</c>.

Type: string?

Where ​

Gets or sets a condition as a JSON tree, the one Filter parses to, ANDed with the others: <c>{"and": [{"eq": [{"path": "status"}, {"value": "open"}]}, ...]}</c>.

Type: JsonElement?

Order ​

Gets or sets the order as OData's <c>$orderby</c> writes it, in place of OrderBy: <c>placed_at desc, customer/name</c>.

Type: string?

Expand ​

Gets or sets the relations to read with each row, as OData's <c>$expand</c> writes them: <c>lines($filter=qty gt 0;$orderby=id;$top=5;$expand=product),customer</c>.

Type: string?

After ​

Gets or sets the cursor of the page this one follows, as a page's <c>pagination.nextCursor</c> gives it (<c>$after</c>): the rows after it, in the same order. Not with Skip.

Type: string?

Apply ​

Gets or sets the rows' grouping and aggregates, as OData's <c>$apply</c> writes them: <c>filter(status eq 'open')/groupby((customer_id),aggregate(amount with sum as total,$count as orders))</c>. With it, the results are the groups, and the filter, order and page apply to them.

Type: string?

Gets or sets the words the rows' searchable columns must hold (<c>$search</c>): every word, in any of the columns the table is declared searchable by; a phrase in double quotes is one.

Type: string?

ApplyTree ​

Gets or sets the grouping as a JSON tree, as Where is to Filter: <c>{"filter": node, "groupBy": ["customer_id"], "aggregate": [{"path": "amount", "with": "sum", "as": "total"}]}</c>.

Type: JsonElement?

SchemaName ​

Gets or sets the schema name. This is set internally from the route and not by the user.

Type: string?