Class Query<T>
Represents a query builder.
Inheritance
Namespace: Umbraco.Cms.Infrastructure.Persistence.Querying
Assembly: Umbraco.Infrastructure.dll
Syntax
public class Query<T> : IQuery<T>
Type Parameters
| Name | Description |
|---|---|
| T |
Remarks
A query builder translates Linq queries into Sql queries.
Constructors
View SourceQuery(ISqlContext)
Initializes a new instance of the Query<T> class using the specified SQL context.
Declaration
public Query(ISqlContext sqlContext)
Parameters
| Type | Name | Description |
|---|---|---|
| ISqlContext | sqlContext | The ISqlContext instance that provides SQL generation and mapping capabilities for the query. |
Methods
View SourceGetWhereClauses()
Returns all translated where clauses and their associated SQL parameters.
Declaration
public IEnumerable<Tuple<string, object[]>> GetWhereClauses()
Returns
| Type | Description |
|---|---|
| IEnumerable<Tuple<string, object[]>> | An enumerable of tuples, each containing a where clause string and its associated SQL parameters. |
Where(Expression<Func<T, bool>>?)
Adds a WHERE clause to the query using the specified predicate expression.
Declaration
public virtual IQuery<T> Where(Expression<Func<T, bool>>? predicate)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression<Func<T, bool>> | predicate | The predicate expression used to filter the query results. If |
Returns
| Type | Description |
|---|---|
| IQuery<T> | An IQuery<T> representing the query with the applied |
WhereAny(IEnumerable<Expression<Func<T, bool>>>?)
Adds a set of where clauses to the query, combined using the logical OR operator.
Declaration
public virtual IQuery<T> WhereAny(IEnumerable<Expression<Func<T, bool>>>? predicates)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<Expression<Func<T, bool>>> | predicates | A collection of predicate expressions to combine with OR in the where clause. If |
Returns
| Type | Description |
|---|---|
| IQuery<T> | The current IQuery<T> instance with the OR-ed where clauses applied. |
WhereIn(Expression<Func<T, object>>?, IEnumerable?)
Adds a where-in clause to the query for the specified field and values.
Declaration
public virtual IQuery<T> WhereIn(Expression<Func<T, object>>? fieldSelector, IEnumerable? values)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression<Func<T, object>> | fieldSelector | An expression that selects the field to which the where-in clause will be applied. |
| IEnumerable | values | A collection of values to match against the selected field. |
Returns
| Type | Description |
|---|---|
| IQuery<T> | An IQuery<T> representing the query with the where-in clause applied. |
WhereNotIn(Expression<Func<T, object>>?, IEnumerable?)
Adds a WHERE NOT IN clause to the query for the specified field and values.
Declaration
public virtual IQuery<T> WhereNotIn(Expression<Func<T, object>>? fieldSelector, IEnumerable? values)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression<Func<T, object>> | fieldSelector | An expression that selects the field to which the |
| IEnumerable | values | A collection of values to exclude from the results for the specified field. |
Returns
| Type | Description |
|---|---|
| IQuery<T> | The current IQuery<T> instance with the |