MongoDB · Types · Queries
ArxQueryExpression
Definition
- Namespace
ARX.SDK.Query- Package
ARX.SDK
public class ArxQueryExpressionA query for RetrieveMultiple: what to read from (Source: a table, view or function), the columns, the criteria (nested AND/OR), joins (LinkEntities), order, paging, distinct and aggregates. Every name in it is validated and quoted by the provider, every value sent as a parameter.
Constructor
ArxQueryExpression()A query with no row source yet: set EntityName or Source.
ArxQueryExpression(string entityName)A query on a table or view (optionally schema-qualified:
reporting.v_sales).Parameter Type Description entityNamestringThe table or view to read (on PostgreSQL also a materialized view), or schema.name.ArxQueryExpression(ArxRowSource source)A query on any row source: a table, a view, or a function returning rows (
Function).Parameter Type Description sourceArxRowSourceWhat to read from: a table by name, or a function with its arguments.
Properties
ArxRowSource Source { get; set; }What the query reads from.
string EntityName { get; set; }The row source's name. Setting it makes the source that table or view.
bool Distinct { get; set; }SELECT DISTINCT: rows that differ in no selected column come back once. A distinct (or aggregate) query doesn't add the id to the columns, since it would make every row distinct, so its rows have noArxEntity.RecordId: select the id column if you need it.int? Top { get; set; }At most this many rows (
LIMIT), without paging. Can't be combined withPageInfo(ARX1001).ArxColumnSet ColumnSet { get; set; }The columns to read. Empty (the default) or
AllColumnsreads every column. A column can be writtencolumn._lk.table.column1,column2to join a referenced table directly.ArxFilterExpression Criteria { get; set; }The conditions rows have to meet (nested And/Or).
List<ArxOrderExpression> Orders { get; set; }The sort keys, in order; AddOrder adds one.
List<ArxLinkEntity> LinkEntities { get; set; }The joins; AddLink adds one.
ArxPagingInfo? PageInfo { get; set; }Offset paging: the page size and number, and whether to return the total (in the same round trip).
ArxAggregateInfo? AggregateInfo { get; set; }Aggregates and group by; null for a plain read.
Methods
void AddOrder(string attributeName, ArxOrderType orderType)Orders the results by an attribute; call again for the next key.
Parameter Type Description attributeNamestringThe column to order by. orderTypeArxOrderTypeAscending or Descending. void AddOrder(string entityAlias, string attributeName, ArxOrderType orderType)Orders by a column of a joined entity, named by its alias.
Parameter Type Description entityAliasstringThe link alias the column belongs to. attributeNamestringThe column to order by. orderTypeArxOrderTypeAscending or Descending. ArxLinkEntity AddLink(string linkToEntityName, string linkFromAttributeName, string linkToAttributeName, ArxJoinOperator joinOperator)Joins a table (see
ArxLinkEntity) and returns the join, to add its columns, alias and criteria.Parameter Type Description linkToEntityNamestringThe table to join. linkFromAttributeNamestringThe column of the query's own table that the join matches. linkToAttributeNamestringThe column of the joined table that it matches. joinOperatorArxJoinOperatorINNER (rows with a match only) or LEFT (every row, with nulls where nothing matches).
Usage
A line from a verified sample; the full, runnable code is on its page.
var query = new ArxQueryExpression("legacy_customer");Use fields named outside the name rule, through aliases, scenario 2
Used in:
- Use fields named outside the name rule, through aliasesCreate
- Log every call through ILoggerCreate
- Read many recordsRetrieveMultiple
- Page through resultsRetrieveMultiple
- Read an account with its contactsRetrieveMultiple
- A report by industryRetrieveMultiple
- Catch an injection attemptRetrieveMultiple
- Read your writes in a transactionRetrieveMultiple
- A security check around a search endpointRetrieveMultiple
- Set up the service from the database's schemaRetrieveMultiple
- Protect paging cookiesRetrieveMultiple