Show / Hide Table of Contents

Class Query

Base class of the data base query.

Inheritance
System.Object
Query
Delete
Select
Update
Implements
IParametrizedQuery
ISqlGenerating
ICacheableQuery
System.ICloneable
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Terrasoft.Core.DB
Assembly: Terrasoft.Core.dll
Syntax
public abstract class Query : IParametrizedQuery, ISqlGenerating, ICacheableQuery, ICloneable

Constructors

Query()

Declaration
protected Query()

Query(Query)

Declaration
protected Query(Query source)
Parameters
Type Name Description
Query source

Properties

BuildParametersAsValue

Determines whether the query parameters are to be added as values into the query text.

Declaration
public bool BuildParametersAsValue { get; set; }
Property Value
Type Description
System.Boolean

CachedSqlText

Cached text of the query.

Declaration
public string CachedSqlText { get; set; }
Property Value
Type Description
System.String

Condition

Gets the Where condition of the query.

Declaration
public QueryCondition Condition { get; }
Property Value
Type Description
QueryCondition

DBEngine

Declaration
protected DBEngine DBEngine { get; }
Property Value
Type Description
DBEngine

GroupByItems

The collection of expressions by which the query results are grouped.

Declaration
public QueryColumnExpressionCollection GroupByItems { get; }
Property Value
Type Description
QueryColumnExpressionCollection

HasCondition

Determines whether this query has the Where condition.

Declaration
public bool HasCondition { get; }
Property Value
Type Description
System.Boolean

HasGroupByItems

Indicates whether the query expressions by which to group are defined in the query.

Declaration
public bool HasGroupByItems { get; }
Property Value
Type Description
System.Boolean

HasHavingCondition

Determines whether this query has the Having statement.

Declaration
public bool HasHavingCondition { get; }
Property Value
Type Description
System.Boolean

HasHints

Determines the presence of hints.

Declaration
public bool HasHints { get; }
Property Value
Type Description
System.Boolean

HasJoins

Determines whether the query has at least one Join clause.

Declaration
public bool HasJoins { get; }
Property Value
Type Description
System.Boolean

HasOrderByItems

Indicates whether the query expressions by which to sort are defined.

Declaration
public bool HasOrderByItems { get; }
Property Value
Type Description
System.Boolean

HasParameters

Determines whether the query has parameters.

Declaration
public bool HasParameters { get; }
Property Value
Type Description
System.Boolean

HasUnionQueries

Determines whether the given query has queries joined with it by the UNION operator.

Declaration
public bool HasUnionQueries { get; }
Property Value
Type Description
System.Boolean

HavingCondition

Gets the Having statement of the query.

Declaration
public QueryCondition HavingCondition { get; }
Property Value
Type Description
QueryCondition

Hints

Declaration
public QueryHintCollection Hints { get; set; }
Property Value
Type Description
QueryHintCollection

IsCacheEnabled

Determines whether the query text is being cached.

Declaration
public bool IsCacheEnabled { get; set; }
Property Value
Type Description
System.Boolean

IsUnionTypeAll

Determines whether to apply the All parameter for the UNION operator in this query.

Declaration
public bool IsUnionTypeAll { get; set; }
Property Value
Type Description
System.Boolean

Joins

Collection of Join statements of the given query.

Declaration
public JoinCollection Joins { get; }
Property Value
Type Description
JoinCollection

OrderByItems

The collection of expressions by which the query results are sorted.

Declaration
public OrderByItemCollection OrderByItems { get; }
Property Value
Type Description
OrderByItemCollection

Parameters

Collection of the query parameters.

Declaration
public QueryParameterCollection Parameters { get; }
Property Value
Type Description
QueryParameterCollection

RowCount

Number of first rows of the result set returned by the query.

Declaration
public int RowCount { get; set; }
Property Value
Type Description
System.Int32

UnionQueries

Collection of queries joined with the given query by the UNION operator.

Declaration
public SelectQueryCollection UnionQueries { get; }
Property Value
Type Description
SelectQueryCollection

UserConnection

User connection.

Declaration
public UserConnection UserConnection { get; set; }
Property Value
Type Description
UserConnection

Methods

AddCondition(String, String, LogicalOperation)

To the current query condition, adds a predicate for the column with the specified alias from the specified source, using the specified logical operation.

Declaration
public QueryCondition AddCondition(string sourceAlias, string sourceColumnAlias, LogicalOperation logicalOperation)
Parameters
Type Name Description
System.String sourceAlias

The alias of the source.

System.String sourceColumnAlias

The alias of the column.

LogicalOperation logicalOperation

The logical operation that is used to add the predicate.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the result query condition.

Exceptions
Type Condition
UnsupportedTypeException

If the unspecified type of logical operation is passed as the logicalOperation parameter.

AddCondition(String, LogicalOperation)

To the current query condition, adds a predicate for the column with the specified alias, using the specified logical operation.

Declaration
public QueryCondition AddCondition(string sourceColumnAlias, LogicalOperation logicalOperation)
Parameters
Type Name Description
System.String sourceColumnAlias

The alias of the column.

LogicalOperation logicalOperation

The logical operation that is used to add the predicate.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the result query condition.

Exceptions
Type Condition
UnsupportedTypeException

If the unspecified type of logical operation is passed as the logicalOperation parameter.

AddCondition(LogicalOperation)

To the current query condition, adds the empty condition, using the specified logical operation.

Declaration
public QueryCondition AddCondition(LogicalOperation logicalOperation)
Parameters
Type Name Description
LogicalOperation logicalOperation

The logical operation that is used to add the condition.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the result query condition.

Exceptions
Type Condition
UnsupportedTypeException

If the unspecified type of logical operation is passed as the logicalOperation parameter.

AddCondition(IQueryColumnExpressionConvertible, LogicalOperation)

To the current query condition, adds the passed-in expression as the predicate, using the specified logical operation.

Declaration
public QueryCondition AddCondition(IQueryColumnExpressionConvertible expression, LogicalOperation logicalOperation)
Parameters
Type Name Description
IQueryColumnExpressionConvertible expression

The expression being added as the predicate in the query condition.

LogicalOperation logicalOperation

The logical operation that is used to add the predicate.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the result query condition.

Exceptions
Type Condition
UnsupportedTypeException

If the unspecified type of logical operation is passed as the logicalOperation parameter.

AddCondition(Query, LogicalOperation)

To the current query condition, adds the passed-in subquery as the predicate, using the specified logical operation.

Declaration
public QueryCondition AddCondition(Query subSelectQuery, LogicalOperation logicalOperation)
Parameters
Type Name Description
Query subSelectQuery

The subquery that is added to the query condition as the predicate.

LogicalOperation logicalOperation

The logical operation that is used to add the predicate.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the result query condition.

Exceptions
Type Condition
UnsupportedTypeException

If the unspecified type of logical operation is passed as the logicalOperation parameter.

AddCondition(QueryColumnExpression, LogicalOperation)

To the current query condition, adds the passed-in expression as the predicate, using the specified logical operation.

Declaration
public QueryCondition AddCondition(QueryColumnExpression columnExpression, LogicalOperation logicalOperation)
Parameters
Type Name Description
QueryColumnExpression columnExpression

The expression being added as the predicate in the query condition.

LogicalOperation logicalOperation

The logical operation that is used to add the predicate.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the result query condition.

Exceptions
Type Condition
UnsupportedTypeException

If the unspecified type of logical operation is passed as the logicalOperation parameter.

AddCondition(QueryCondition, LogicalOperation)

To the current query condition, adds the passed-in query condition as the predicate, using the specified logical operation.

Declaration
public Query AddCondition(QueryCondition condition, LogicalOperation logicalOperation)
Parameters
Type Name Description
QueryCondition condition

The query condition being added as the predicate.

LogicalOperation logicalOperation

The logical operation that is used to add the predicate.

Returns
Type Description
Query

The current Query instance.

Exceptions
Type Condition
UnsupportedTypeException

If the unspecified type of logical operation is passed as the logicalOperation parameter.

AddCondition(QueryParameter, LogicalOperation)

To the current query condition, adds the predicate for the passed-in query parameter, using the specified type of logical operation.

Declaration
public QueryCondition AddCondition(QueryParameter parameter, LogicalOperation logicalOperation)
Parameters
Type Name Description
QueryParameter parameter

The query parameter.

LogicalOperation logicalOperation

The logical operation that is used to add the predicate.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the result query condition.

Exceptions
Type Condition
UnsupportedTypeException

If the unspecified type of logical operation is passed as the logicalOperation parameter.

AddCondition(Select, LogicalOperation)

To the current query condition, adds the passed-in selection subquery as the predicate, using the specified logical operation.

Declaration
public QueryCondition AddCondition(Select subSelect, LogicalOperation logicalOperation)
Parameters
Type Name Description
Select subSelect

The select subquery that is added as the predicate in the query condition.

LogicalOperation logicalOperation

The logical operation that is used to add the predicate.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the result query condition.

Exceptions
Type Condition
UnsupportedTypeException

If the unspecified type of logical operation is passed as the logicalOperation parameter.

And()

To the current query condition, adds the empty condition, using the AND logical operation.

Declaration
public QueryCondition And()
Returns
Type Description
QueryCondition

The QueryCondition instance that represents the result query condition.

And(String)

To the current query condition, adds a predicate for the column with the specified alias, using the AND logical operation.

Declaration
public QueryCondition And(string sourceColumnAlias)
Parameters
Type Name Description
System.String sourceColumnAlias
Returns
Type Description
QueryCondition

The QueryCondition instance that represents the result query condition.

And(String, String)

To the current query condition, adds a predicate for the column with the specified alias from the specified source, using the AND logical operation.

Declaration
public QueryCondition And(string sourceAlias, string sourceColumnAlias)
Parameters
Type Name Description
System.String sourceAlias

The alias of the source.

System.String sourceColumnAlias

The alias of the column.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the result query condition.

And(IQueryColumnExpressionConvertible)

To the current query condition, adds the passed-in expression as the predicate, using the AND logical operation.

Declaration
public QueryCondition And(IQueryColumnExpressionConvertible expression)
Parameters
Type Name Description
IQueryColumnExpressionConvertible expression

The expression being added as the predicate in the query condition.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the result query condition.

And(Query)

To the current query condition, adds the passed-in query as the predicate, using the AND logical operation.

Declaration
public QueryCondition And(Query subSelectQuery)
Parameters
Type Name Description
Query subSelectQuery

The query being added as the predicate in the query condition.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the result query condition.

And(QueryColumnExpression)

To the current query condition, adds the passed-in expression as the predicate.

Declaration
public QueryCondition And(QueryColumnExpression columnExpression)
Parameters
Type Name Description
QueryColumnExpression columnExpression

The expression being added as the predicate in the query condition.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the result query condition.

And(QueryCondition)

To the current query condition, adds the passed-in query condition as the predicate, using the AND logical operation.

Declaration
public Query And(QueryCondition condition)
Parameters
Type Name Description
QueryCondition condition

The query condition being added as the predicate.

Returns
Type Description
Query

The current Query instance.

And(QueryParameter)

To the current query condition, adds the predicate for the passed-in query parameter, using the AND logical operation.

Declaration
public QueryCondition And(QueryParameter parameter)
Parameters
Type Name Description
QueryParameter parameter

The query parameter.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the result query condition.

And(Select)

To the current query condition, adds the passed-in selection subquery as the predicate, using the AND logical operation.

Declaration
public QueryCondition And(Select subSelect)
Parameters
Type Name Description
Select subSelect

The select subquery being added as the predicate in the query condition.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the result query condition.

BuildSqlText(StringBuilder)

Builds the query text, using the passed-in System.Text.StringBuilder instance.

Declaration
public abstract void BuildSqlText(StringBuilder sb)
Parameters
Type Name Description
System.Text.StringBuilder sb

The System.Text.StringBuilder instance used to create query text.

Clone()

Creates the clone of the current Query instance.

Declaration
public abstract object Clone()
Returns
Type Description
System.Object

A new Query instance that represents the copy of the current instance.

CloseBlock()

Closes the conditions block.

Declaration
public Query CloseBlock()
Returns
Type Description
Query

The current Query instance.

Exceptions
Type Condition
InvalidObjectStateException

If the query condition does not contain open blocks.

Execute()

Executes SQL query and returns number of affected rows.

Declaration
public virtual int Execute()
Returns
Type Description
System.Int32

Number of affected rows.

Execute(DBExecutor)

Executes SQL query using given instance of DBExecutor and returns number of affected rows.

Declaration
public virtual int Execute(DBExecutor dbExecutor)
Parameters
Type Name Description
DBExecutor dbExecutor

Instance of DBExecutor, to be used for SQL query.

Returns
Type Description
System.Int32

Number of affected rows.

FullOuterJoin(String)

Associates the schema with the specified name with the current query, using the full outer join.

Declaration
public Join FullOuterJoin(string schemaName)
Parameters
Type Name Description
System.String schemaName

Name of the schema to associate.

Returns
Type Description
Join

The Join instance that associates the schema with the schemaName name with the current query, using the full outer join.

FullOuterJoin(Query)

Associates the specified random subquery with the current query, using the full outer join.

Declaration
public Join FullOuterJoin(Query subSelectQuery)
Parameters
Type Name Description
Query subSelectQuery

Random subquery to associate.

Returns
Type Description
Join

The Join instance that associates the subSelectQuery random subquery with the current query, using the full outer join.

FullOuterJoin(QuerySourceExpression)

Associates the specified expression with the current query, using the full outer join.

Declaration
public Join FullOuterJoin(QuerySourceExpression sourceExpression)
Parameters
Type Name Description
QuerySourceExpression sourceExpression

The expression to associate.

Returns
Type Description
Join

The Join instance that associates the sourceExpression expression with the current query, using the full outer join.

FullOuterJoin(Select)

Associates the specified select subquery with the current query, using the full outer join.

Declaration
public Join FullOuterJoin(Select subSelect)
Parameters
Type Name Description
Select subSelect

Selection subquery to associate.

Returns
Type Description
Join

The Join instance that associates the subSelect data selection subquery with the current query, using the full outer join.

GetSqlText()

Gets the query text.

Declaration
public abstract string GetSqlText()
Returns
Type Description
System.String

The query text.

GetUsingParameters()

Gets the collection of the query parameters.

Declaration
public virtual QueryParameterCollection GetUsingParameters()
Returns
Type Description
QueryParameterCollection

Collection of the query parameters.

GroupBy(String)

Groups query results in the descending order by the column with the specified alias.

Declaration
public Query GroupBy(string sourceColumnAlias)
Parameters
Type Name Description
System.String sourceColumnAlias

The alias of the column by which the sorting is performed.

Returns
Type Description
Query

The current Query instance.

GroupBy(String, String)

Groups the query results by the column with the specified alias from the specified source.

Declaration
public Query GroupBy(string sourceAlias, string sourceColumnAlias)
Parameters
Type Name Description
System.String sourceAlias

The alias of the source.

System.String sourceColumnAlias

The alias of the column by which the sorting is performed.

Returns
Type Description
Query

The current Query instance.

GroupBy(IQueryColumnExpressionConvertible)

Groups the query results, using the value of the passed-in expression as the grouping key.

Declaration
public Query GroupBy(IQueryColumnExpressionConvertible expression)
Parameters
Type Name Description
IQueryColumnExpressionConvertible expression

The expression whose value is used as the grouping key.

Returns
Type Description
Query

The current Query instance.

GroupBy(QueryColumnExpression)

Groups the query results, using the value of the passed-in expression as the grouping key.

Declaration
public Query GroupBy(QueryColumnExpression columnExpression)
Parameters
Type Name Description
QueryColumnExpression columnExpression

The expression whose value is used as the grouping key.

Returns
Type Description
Query

The current Query instance.

Having()

Adds the empty grouping condition to the current query.

Declaration
public QueryCondition Having()
Returns
Type Description
QueryCondition

The QueryCondition instance that represents the empty grouping condition.

Having(String)

In the current query, adds the grouping condition for the column with the specified alias.

Declaration
public QueryCondition Having(string sourceColumnAlias)
Parameters
Type Name Description
System.String sourceColumnAlias

The alias of the column by which the grouping condition is added.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the grouping condition for the column with the sourceColumnAlias alias.

Having(String, String)

In the current query, adds the grouping condition for the column with the specified alias from the specified source.

Declaration
public QueryCondition Having(string sourceAlias, string sourceColumnAlias)
Parameters
Type Name Description
System.String sourceAlias

The alias of the source.

System.String sourceColumnAlias

The alias of the column by which the grouping condition is added.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the grouping condition for the column with the sourceColumnAlias alias from the source with the sourceAlias alias.

Having(IQueryColumnExpressionConvertible)

In the current query, adds the grouping condition for the value of the passed-in expression.

Declaration
public QueryCondition Having(IQueryColumnExpressionConvertible expression)
Parameters
Type Name Description
IQueryColumnExpressionConvertible expression

The expression for whose value the grouping condition is added.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the grouping condition for the value of the expression expression.

Having(Query)

In the current query, adds the grouping condition for results of the passed-in random subquery.

Declaration
public QueryCondition Having(Query subSelectQuery)
Parameters
Type Name Description
Query subSelectQuery

The random subquery for whose results the grouping condition is added.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the grouping condition for results of the subSelectQuery random subquery.

Having(QueryColumnExpression)

In the current query, adds the grouping condition for the value of the passed-in expression.

Declaration
public QueryCondition Having(QueryColumnExpression columnExpression)
Parameters
Type Name Description
QueryColumnExpression columnExpression

The expression for whose value the grouping condition is added.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the grouping condition for the value of the columnExpression expression.

Having(QueryParameter)

In the current query, adds the grouping condition for the specified query parameter.

Declaration
public QueryCondition Having(QueryParameter parameter)
Parameters
Type Name Description
QueryParameter parameter

The query parameter for which the grouping condition is added.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the grouping condition for the parameter query parameter.

Having(Select)

In the current query, adds the grouping condition for results of the passed-in select subquery.

Declaration
public QueryCondition Having(Select subSelect)
Parameters
Type Name Description
Select subSelect

The select subquery for whose results the grouping condition is added.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the group condition for results of the subSelect selection subquery.

InitializeParameters()

Initializes the query parameters.

Declaration
public QueryParameterCollection InitializeParameters()
Returns
Type Description
QueryParameterCollection

Collection of the initialized query parameters.

InnerJoin(String)

Associates the specified schema with the current query, using the inner join.

Declaration
public Join InnerJoin(string schemaName)
Parameters
Type Name Description
System.String schemaName

Name of the schema to associate.

Returns
Type Description
Join

The Join instance that associates the schema with the schemaName name with the current query, using the inner join.

InnerJoin(Query)

Associates the specified random subquery with the current query, using the inner join.

Declaration
public Join InnerJoin(Query subSelectQuery)
Parameters
Type Name Description
Query subSelectQuery

Random subquery to associate.

Returns
Type Description
Join

The Join instance that associates the subSelectQuery random subquery with the current query, using the inner join.

InnerJoin(QuerySourceExpression)

Associates the specified expression with the current query, using the inner join.

Declaration
public Join InnerJoin(QuerySourceExpression sourceExpression)
Parameters
Type Name Description
QuerySourceExpression sourceExpression

The expression to associate.

Returns
Type Description
Join

The Join instance that associates the sourceExpression expression with the current query, using the inner join.

InnerJoin(Select)

Associates the specified select subquery with the current query, using the inner join.

Declaration
public Join InnerJoin(Select subSelect)
Parameters
Type Name Description
Select subSelect

Selection subquery to associate.

Returns
Type Description
Join

The Join instance that associates the subSelect data selection subquery with the current query, using the inner join.

Join(JoinType, String)

Associates the specified schema with the current query, using the specified join type.

Declaration
public Join Join(JoinType joinType, string schemaName)
Parameters
Type Name Description
JoinType joinType

Join type.

System.String schemaName

Name of the schema to associate.

Returns
Type Description
Join

The Join instance that associates the schema with the schemaName name with the current query, using the joinType join type.

Join(JoinType, Query)

Associates the specified random subquery with the current query, using the specified join type.

Declaration
public Join Join(JoinType joinType, Query subSelectQuery)
Parameters
Type Name Description
JoinType joinType

Join type.

Query subSelectQuery

Random subquery to associate.

Returns
Type Description
Join

The Join instance that associates the subSelectQuery random subquery with the current query, using the joinType join type.

Join(JoinType, QuerySourceExpression)

Associates the specified expression with the current query, using the specified join type.

Declaration
public Join Join(JoinType joinType, QuerySourceExpression sourceExpression)
Parameters
Type Name Description
JoinType joinType

Join type.

QuerySourceExpression sourceExpression

The expression to associate.

Returns
Type Description
Join

The Join instance that associates the sourceExpression expression with the current query, using the joinType join type.

Join(JoinType, Select)

Associates the specified data select subquery with the current query, using the specified join type.

Declaration
public Join Join(JoinType joinType, Select subSelect)
Parameters
Type Name Description
JoinType joinType

Join type.

Select subSelect

Data select subquery to associate.

Returns
Type Description
Join

The Join instance that associates the subSelect data selection subquery with the current query, using the joinType join type.

LeftOuterJoin(String)

Associates the schema with the specified name with the current query, using the left outer join.

Declaration
public Join LeftOuterJoin(string schemaName)
Parameters
Type Name Description
System.String schemaName

Name of the schema to associate.

Returns
Type Description
Join

The Join instance that associates the schema with the schemaName name with the current query, using the left outer join.

LeftOuterJoin(Query)

Associates the specified random subquery with the current query, using the left outer join.

Declaration
public Join LeftOuterJoin(Query subSelectQuery)
Parameters
Type Name Description
Query subSelectQuery

Random subquery to associate.

Returns
Type Description
Join

The Join instance that associates the subSelectQuery random subquery with the current query, using the left outer join.

LeftOuterJoin(QuerySourceExpression)

Associates the specified expression with the current query, using the left outer join.

Declaration
public Join LeftOuterJoin(QuerySourceExpression sourceExpression)
Parameters
Type Name Description
QuerySourceExpression sourceExpression

The expression to associate.

Returns
Type Description
Join

The Join instance that associates the sourceExpression expression with the current query, using the left outer join.

LeftOuterJoin(Select)

Associates the specified select subquery with the current query, using the left outer join.

Declaration
public Join LeftOuterJoin(Select subSelect)
Parameters
Type Name Description
Select subSelect

Selection subquery to associate.

Returns
Type Description
Join

The Join instance that associates the subSelect data selection subquery with the current query, using the left outer join.

Or()

To the current query condition, adds the empty condition, using the OR logical operation.

Declaration
public QueryCondition Or()
Returns
Type Description
QueryCondition

The QueryCondition instance that represents the result query condition.

Or(String)

To the current query condition, adds a predicate for the column with the specified alias, using the OR logical operation.

Declaration
public QueryCondition Or(string sourceColumnAlias)
Parameters
Type Name Description
System.String sourceColumnAlias

The alias of the column.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the result query condition.

Or(String, String)

To the current query condition, adds a predicate for the column with the specified alias from the specified source, using the OR logical operation.

Declaration
public QueryCondition Or(string sourceAlias, string sourceColumnAlias)
Parameters
Type Name Description
System.String sourceAlias

The alias of the column.

System.String sourceColumnAlias

The alias of the source.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the result query condition.

Or(IQueryColumnExpressionConvertible)

To the current query condition, adds the passed-in expression as the predicate, using the OR logical operation.

Declaration
public QueryCondition Or(IQueryColumnExpressionConvertible expression)
Parameters
Type Name Description
IQueryColumnExpressionConvertible expression

The expression being added as the predicate in the query condition.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the result query condition.

Or(Query)

To the current query condition, adds the passed-in subquery as the predicate, using the OR logical operation.

Declaration
public QueryCondition Or(Query subSelectQuery)
Parameters
Type Name Description
Query subSelectQuery

The subquery being added as the predicate in the query condition.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the result query condition.

Or(QueryColumnExpression)

To the current query condition, adds the passed-in expression as the predicate, using the OR logical operation.

Declaration
public QueryCondition Or(QueryColumnExpression columnExpression)
Parameters
Type Name Description
QueryColumnExpression columnExpression

The expression being added as the predicate in the query condition.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the result query condition.

Or(QueryCondition)

To the current query condition, adds the passed-in query condition as the predicate, using the OR logical operation.

Declaration
public Query Or(QueryCondition condition)
Parameters
Type Name Description
QueryCondition condition

The query condition being added as the predicate.

Returns
Type Description
Query

The current Query instance.

Or(QueryParameter)

To the current query condition, adds the predicate for the passed-in query parameter, using the OR logical operation.

Declaration
public QueryCondition Or(QueryParameter parameter)
Parameters
Type Name Description
QueryParameter parameter

The query parameter.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the result query condition.

Or(Select)

To the current query condition, adds the passed-in selection subquery as the predicate, using the OR logical operation.

Declaration
public QueryCondition Or(Select subSelect)
Parameters
Type Name Description
Select subSelect

The select subquery being added as the predicate in the query condition.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the result query condition.

OrderBy(OrderDirectionStrict, String)

Sorts query results in the specified order by the column with the specified alias.

Declaration
public Query OrderBy(OrderDirectionStrict direction, string sourceColumnAlias)
Parameters
Type Name Description
OrderDirectionStrict direction

The sorting order for the query results.

System.String sourceColumnAlias

The alias of the column by which the sorting is performed.

Returns
Type Description
Query

The current Query instance.

OrderBy(OrderDirectionStrict, String, String)

Sorts the query results in the specified order by the column with the specified alias from the specified source.

Declaration
public Query OrderBy(OrderDirectionStrict direction, string sourceAlias, string sourceColumnAlias)
Parameters
Type Name Description
OrderDirectionStrict direction

The sorting order for the query results.

System.String sourceAlias

The alias of the source.

System.String sourceColumnAlias

The alias of the column by which the sorting is performed.

Returns
Type Description
Query

OrderBy(OrderDirectionStrict, IQueryColumnExpressionConvertible)

Sorts the query results in the specified order, using the value of the passed-in expression as the sort key.

Declaration
public Query OrderBy(OrderDirectionStrict direction, IQueryColumnExpressionConvertible expression)
Parameters
Type Name Description
OrderDirectionStrict direction

The sorting order for the query results.

IQueryColumnExpressionConvertible expression

The expression whose value is used as the sort key.

Returns
Type Description
Query

The current Query instance.

OrderBy(OrderDirectionStrict, Query)

Sorts the query results in the specified order, using the results of the passed-in random subquery as the sort key.

Declaration
public Query OrderBy(OrderDirectionStrict direction, Query subSelectQuery)
Parameters
Type Name Description
OrderDirectionStrict direction

The sorting order for the query results.

Query subSelectQuery

The random subquery whose results are used as the sort key.

Returns
Type Description
Query

The current Query instance.

OrderBy(OrderDirectionStrict, QueryColumnExpression)

Sorts the query results in the specified order, using the value of the passed-in expression as the sort key.

Declaration
public Query OrderBy(OrderDirectionStrict direction, QueryColumnExpression columnExpression)
Parameters
Type Name Description
OrderDirectionStrict direction

The sorting order for the query results.

QueryColumnExpression columnExpression

The expression whose value is used as the sort key.

Returns
Type Description
Query

The current Query instance.

OrderBy(OrderDirectionStrict, QueryFunction)

Sorts the query results in the specified order, using the value of the passed-in function as the sort key.

Declaration
public Query OrderBy(OrderDirectionStrict direction, QueryFunction queryFunction)
Parameters
Type Name Description
OrderDirectionStrict direction

The sorting order for the query results.

QueryFunction queryFunction

The function whose value is used as the sort key.

Returns
Type Description
Query

The current Query instance.

OrderBy(OrderDirectionStrict, Select)

Sorts the query results in the specified order, using the results of the passed-in selection subquery as the sort key.

Declaration
public Query OrderBy(OrderDirectionStrict direction, Select subSelect)
Parameters
Type Name Description
OrderDirectionStrict direction

The sorting order.

Select subSelect

The select subquery whose results are used as the sort key.

Returns
Type Description
Query

The current Query instance.

OrderByAsc(String)

Sorts query results in the ascending order by the column with the specified alias.

Declaration
public Query OrderByAsc(string sourceColumnAlias)
Parameters
Type Name Description
System.String sourceColumnAlias

The alias of the column by which the sorting is performed.

Returns
Type Description
Query

The current Query instance.

OrderByAsc(String, String)

Sorts the query results in the ascending order by the column with the specified alias from the specified source.

Declaration
public Query OrderByAsc(string sourceAlias, string sourceColumnAlias)
Parameters
Type Name Description
System.String sourceAlias

The alias of the source.

System.String sourceColumnAlias

The alias of the column by which the sorting is performed.

Returns
Type Description
Query

The current Query instance.

OrderByAsc(IQueryColumnExpressionConvertible)

Sorts the query results in the ascending order, using the value of the passed-in expression as the sort key.

Declaration
public Query OrderByAsc(IQueryColumnExpressionConvertible expression)
Parameters
Type Name Description
IQueryColumnExpressionConvertible expression

The expression whose value is used as the sort key.

Returns
Type Description
Query

The current Query instance.

OrderByAsc(Query)

Sorts the query results in the ascending order, using the results of the passed-in random subquery as the sort key.

Declaration
public Query OrderByAsc(Query subSelectQuery)
Parameters
Type Name Description
Query subSelectQuery

The random subquery whose results are used as the sort key.

Returns
Type Description
Query

The current Query instance.

OrderByAsc(QueryColumnExpression)

Sorts the query results in the ascending order, using the value of the passed-in expression as the sort key.

Declaration
public Query OrderByAsc(QueryColumnExpression columnExpression)
Parameters
Type Name Description
QueryColumnExpression columnExpression

The expression whose value is used as the sort key.

Returns
Type Description
Query

The current Query instance.

OrderByAsc(Select)

Sorts the query results in the ascending order, using the results of the passed-in selection subquery as the sort key.

Declaration
public Query OrderByAsc(Select subSelect)
Parameters
Type Name Description
Select subSelect

The select subquery whose results are used as the sort key.

Returns
Type Description
Query

The current Query instance.

OrderByDesc(String)

Sorts query results in the descending order by the column with the specified alias.

Declaration
public Query OrderByDesc(string sourceColumnAlias)
Parameters
Type Name Description
System.String sourceColumnAlias

The alias of the column by which the sorting is performed.

Returns
Type Description
Query

The current Query instance.

OrderByDesc(String, String)

Sorts the query results in the descending order by the column with the specified alias from the specified source.

Declaration
public Query OrderByDesc(string sourceAlias, string sourceColumnAlias)
Parameters
Type Name Description
System.String sourceAlias

The alias of the source.

System.String sourceColumnAlias

The alias of the column by which the sorting is performed.

Returns
Type Description
Query

The current Query instance.

OrderByDesc(IQueryColumnExpressionConvertible)

Sorts the query results in the descending order, using the value of the passed-in expression as the sort key.

Declaration
public Query OrderByDesc(IQueryColumnExpressionConvertible expression)
Parameters
Type Name Description
IQueryColumnExpressionConvertible expression

The expression whose value is used as the sort key.

Returns
Type Description
Query

The current Query instance.

OrderByDesc(Query)

Sorts the query results in the descending order, using the results of the passed-in random subquery as the sort key.

Declaration
public Query OrderByDesc(Query subSelectQuery)
Parameters
Type Name Description
Query subSelectQuery

The random subquery whose results are used as the sort key.

Returns
Type Description
Query

The current Query instance.

OrderByDesc(QueryColumnExpression)

Sorts the query results in the descending order, using the value of the passed-in expression as the sort key.

Declaration
public Query OrderByDesc(QueryColumnExpression columnExpression)
Parameters
Type Name Description
QueryColumnExpression columnExpression

The expression whose value is used as the sort key.

Returns
Type Description
Query

The current Query instance.

OrderByDesc(Select)

Sorts the query results in the descending order, using the results of the passed-in selection subquery as the query key.

Declaration
public Query OrderByDesc(Select subSelect)
Parameters
Type Name Description
Select subSelect

The select subquery whose results are used as the sort key.

Returns
Type Description
Query

The current Query instance.

ResetCachedSqlText()

Clears the cached text of the query.

Declaration
public void ResetCachedSqlText()

ResetParameters()

Clears the collection of the query parameters.

Declaration
public void ResetParameters()

RightOuterJoin(String)

Associates the schema with the specified name with the current query, using the right outer join.

Declaration
public Join RightOuterJoin(string schemaName)
Parameters
Type Name Description
System.String schemaName

Name of the schema to associate.

Returns
Type Description
Join

The Join instance that associates the schema with the schemaName name with the current query, using the right outer join.

RightOuterJoin(Query)

Associates the specified select subquery with the current query, using the right outer join.

Declaration
public Join RightOuterJoin(Query subSelectQuery)
Parameters
Type Name Description
Query subSelectQuery

Selection subquery to associate.

Returns
Type Description
Join

The Join instance that associates the subSelectQuery data selection subquery with the current query, using the right outer join.

RightOuterJoin(QuerySourceExpression)

Associates the specified expression with the current query, using the right outer join.

Declaration
public Join RightOuterJoin(QuerySourceExpression sourceExpression)
Parameters
Type Name Description
QuerySourceExpression sourceExpression

The expression to associate.

Returns
Type Description
Join

The Join instance that associates the sourceExpression expression with the current query, using the right outer join.

RightOuterJoin(Select)

Associates the specified random subquery with the current query, using the right outer join.

Declaration
public Join RightOuterJoin(Select subSelect)
Parameters
Type Name Description
Select subSelect

Random subquery to associate.

Returns
Type Description
Join

The Join instance that associates the subSelect random subquery with the current query, using the right outer join.

SetParameterValue(String, Object)

Sets the value of the query parameter.

Declaration
public void SetParameterValue(string name, object value)
Parameters
Type Name Description
System.String name

The name of the parameter.

System.Object value

The value of the parameter.

Union(Query)

Combines the results of the current query and results of the passed-in random query, excluding duplicate rows from the result set.

Declaration
public Query Union(Query unionSelectQuery)
Parameters
Type Name Description
Query unionSelectQuery

The random query whose results are combined with the results of the current query.

Returns
Type Description
Query

The current Query instance.

Union(Select)

Combines the results of the current query and results of the passed-in selectquery, excluding duplicate rows from the result set.

Declaration
public Query Union(Select unionSelect)
Parameters
Type Name Description
Select unionSelect

The select query whose results are combined with the results of the current query.

Returns
Type Description
Query

The current Query instance.

UnionAll(Query)

Combines the results of the current query and results of the passed-in random query, but duplicate rows are not excluded from the result set.

Declaration
public Query UnionAll(Query unionSelectQuery)
Parameters
Type Name Description
Query unionSelectQuery

The random query whose results are combined with the results of the current query.

Returns
Type Description
Query

The current Query instance.

UnionAll(Select)

Combines the results of the current query and results of the passed-in select query, but duplicate rows are not excluded from the result set.

Declaration
public Query UnionAll(Select unionSelect)
Parameters
Type Name Description
Select unionSelect

The select query whose results are combined with the results of the current query.

Returns
Type Description
Query

The current Query instance.

Where()

Adds the empty initial condition to the current query.

Declaration
public QueryCondition Where()
Returns
Type Description
QueryCondition

The QueryCondition instance that represents the empty initial condition of the current query.

Where(String)

In the current query, adds the initial condition for the column with the specified alias.

Declaration
public QueryCondition Where(string sourceColumnAlias)
Parameters
Type Name Description
System.String sourceColumnAlias

The name of the schema for which the condition is added.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the initial condition for the column with the sourceColumnAlias alias.

Where(String, String)

In the current query, adds a condition for the column with the specified alias from the specified source.

Declaration
public QueryCondition Where(string sourceAlias, string sourceColumnAlias)
Parameters
Type Name Description
System.String sourceAlias

The alias of the source.

System.String sourceColumnAlias

The alias of the column.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the initial condition for the column with the sourceColumnAlias alias from the source with the sourceAlias alias.

Where(IQueryColumnExpressionConvertible)

In the current query, adds the initial condition for the value of the passed-in expression.

Declaration
public QueryCondition Where(IQueryColumnExpressionConvertible expression)
Parameters
Type Name Description
IQueryColumnExpressionConvertible expression

The expression for whose value the initial condition is added.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the initial condition for the value of the expression expression.

Where(Query)

In the current query, adds the initial condition for results of the random subquery.

Declaration
public QueryCondition Where(Query subSelectQuery)
Parameters
Type Name Description
Query subSelectQuery

The random subquery for whose results the initial condition is added.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the initial condition for results of the subSelectQuery random subquery.

Where(QueryColumnExpression)

In the current query, adds the initial condition for the value of the passed-in expression.

Declaration
public QueryCondition Where(QueryColumnExpression columnExpression)
Parameters
Type Name Description
QueryColumnExpression columnExpression

The expression for whose value the initial condition is added.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the initial condition in a form of the columnExpression expression.

Where(QueryCondition)

In the current query, adds the passed-in condition as the initial condition.

Declaration
public Query Where(QueryCondition condition)
Parameters
Type Name Description
QueryCondition condition

The query condition being added as the root condition to the current query.

Returns
Type Description
Query

The current Query instance.

Where(QueryParameter)

In the current query, adds the initial condition for the passed-in query parameter.

Declaration
public QueryCondition Where(QueryParameter parameter)
Parameters
Type Name Description
QueryParameter parameter

The query parameter.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the initial condition for the parameter query parameter.

Where(Select)

In the current query, adds the initial condition for results of the passed-in select subquery.

Declaration
public QueryCondition Where(Select subSelect)
Parameters
Type Name Description
Select subSelect

The select subquery for whose results the initial condition is added.

Returns
Type Description
QueryCondition

The QueryCondition instance that represents the initial condition for results of the subSelect selection subquery.

Explicit Interface Implementations

IParametrizedQuery.InitializeParameters()

Initializes the query parameters.

Declaration
void IParametrizedQuery.InitializeParameters()

Implements

IParametrizedQuery
ISqlGenerating
ICacheableQuery
System.ICloneable

Extension Methods

ReflectionUtilities.GetPropertyValue(Object, String)
ReflectionUtilities.GetPropertyDefValue(Object, String, Object)
ReflectionUtilities.TryGetPropertyValue(Object, String, out Object)
ReflectionUtilities.HasProperty(Object, String)
ReflectionUtilities.GetPropertyValue(Object, String, BindingFlags)
ReflectionUtilities.GetPropertyValueByPath(Object, String)
ReflectionUtilities.SetPropertyValue(Object, String, Object)
ReflectionUtilities.TrySetPropertyValue(Object, String, Object)
ValidateUtilities.CheckArgumentNull(Object, String)
ValidateUtilities.CheckDependencyNull(Object, String)
ValidateUtilities.EnsureDependencyNotNull<T>(T, String)
MetaDataTestUtils.MetaPropertiesShouldNotHaveDefValue<TInstance>(TInstance)
MetaDataTestUtils.MetaPropertiesShouldNotHaveDefValue<TInstance>(TInstance, Boolean)
NSubstituteExtension.Protected(Object, String, Object[])
NSubstituteExtension.Protected(Object, String, Boolean, Object[])
NSubstituteExtension.ProtectedGeneric<T>(Object, String, Object[])
NSubstituteExtension.ProtectedGeneric<T>(Object, String, Boolean, Object[])
NSubstituteExtension.ProtectedProperty(Object, String)
NSubstituteExtension.MatchInstance<T>(T)
SubstituteUtilities.GetIsSubstituteObject(Object)
SubstituteUtilities.Instead<TInstance, TValue>(TInstance, Func<TInstance, TValue>)
Back to top Generated by DocFX