TCriteria Class
Represents a criteria query for retrieving entities or projected values from the database.
Remarks
TCriteria provides a fluent API for constructing queries without writing SQL.
Restrictions are added via Where, associations are joined via CreateAlias, and results are retrieved via List, UniqueResult, or Open.
By default, the criteria object is automatically destroyed after a query method is called; set AutoDestroy to False to reuse the same instance.
Syntax
Unit: Aurelius.Criteria.Base
TCriteria = class(TObject);
Methods
| Name | Description |
|---|---|
| Clone | Creates a deep copy of this criteria instance with all its conditions, ordering, and configuration. |
| CreateAlias | Overloaded CreateAlias(string, string) CreateAlias(string, string, TFetchMode) |
| FetchEager | Configures the specified association path to be fetched eagerly along with the main query. |
| List<E> | Executes the query and returns all results as a typed object list. |
| ListValues | Executes a projected query and returns all results as a list of TCriteriaResult objects. |
| Open<E> | Executes the query and returns a typed cursor for iterating over the results. |
| OrderBy | Overloaded OrderBy(string, Boolean) OrderBy(TProjection, Boolean) |
| OrderBySql | Adds an ordering clause to the query using a raw SQL expression. |
| Refreshing | Configures the criteria to refresh entity data from the database, bypassing the identity map cache. |
| RemovingDuplicated​Entities | Configures the criteria to remove duplicate entity instances from the results. |
| Select | Sets the projection for this criteria query, defining which columns or expressions are selected. |
| Skip | Sets the index of the first row to be returned by the query, skipping the preceding rows. |
| Take | Limits the maximum number of rows returned by the query. |
| UniqueResult<E> | Executes the query and returns a single unique result, or nil if no results are found. |
| UniqueValue | Executes a projected query and returns a single unique result as a TCriteriaResult. |
| Where | Adds a restriction to this criteria query, filtering results by the given criterion. |
Properties
| Name | Description |
|---|---|
| AutoDestroy | Gets or sets whether the criteria object is automatically destroyed after a query is executed. |