Show / Hide Table of Contents

Class Select

Query to select data.

Inheritance
System.Object
Query
Select
Implements
IParametrizedQuery
ISqlGenerating
ICacheableQuery
System.ICloneable
IDBReadableCommand
Inherited Members
Query.Execute()
Query.Execute(DBExecutor)
Query.ResetParameters()
Query.InitializeParameters()
Query.IParametrizedQuery.InitializeParameters()
Query.Join(JoinType, String)
Query.Join(JoinType, Select)
Query.Join(JoinType, Query)
Query.Join(JoinType, QuerySourceExpression)
Query.InnerJoin(String)
Query.InnerJoin(Select)
Query.InnerJoin(Query)
Query.InnerJoin(QuerySourceExpression)
Query.LeftOuterJoin(String)
Query.LeftOuterJoin(Select)
Query.LeftOuterJoin(Query)
Query.LeftOuterJoin(QuerySourceExpression)
Query.RightOuterJoin(String)
Query.RightOuterJoin(Select)
Query.RightOuterJoin(Query)
Query.RightOuterJoin(QuerySourceExpression)
Query.FullOuterJoin(String)
Query.FullOuterJoin(Select)
Query.FullOuterJoin(Query)
Query.FullOuterJoin(QuerySourceExpression)
Query.Where()
Query.Where(String)
Query.Where(String, String)
Query.Where(Select)
Query.Where(Query)
Query.Where(QueryParameter)
Query.Where(QueryColumnExpression)
Query.Where(IQueryColumnExpressionConvertible)
Query.Where(QueryCondition)
Query.And()
Query.And(String)
Query.And(String, String)
Query.And(Select)
Query.And(Query)
Query.And(QueryParameter)
Query.And(QueryColumnExpression)
Query.And(IQueryColumnExpressionConvertible)
Query.And(QueryCondition)
Query.Or()
Query.Or(String)
Query.Or(String, String)
Query.Or(Select)
Query.Or(Query)
Query.Or(QueryParameter)
Query.Or(QueryColumnExpression)
Query.Or(IQueryColumnExpressionConvertible)
Query.Or(QueryCondition)
Query.AddCondition(LogicalOperation)
Query.AddCondition(String, LogicalOperation)
Query.AddCondition(String, String, LogicalOperation)
Query.AddCondition(Select, LogicalOperation)
Query.AddCondition(Query, LogicalOperation)
Query.AddCondition(QueryParameter, LogicalOperation)
Query.AddCondition(QueryColumnExpression, LogicalOperation)
Query.AddCondition(IQueryColumnExpressionConvertible, LogicalOperation)
Query.AddCondition(QueryCondition, LogicalOperation)
Query.CloseBlock()
Query.OrderBy(OrderDirectionStrict, String)
Query.OrderBy(OrderDirectionStrict, String, String)
Query.OrderBy(OrderDirectionStrict, QueryFunction)
Query.OrderBy(OrderDirectionStrict, Select)
Query.OrderBy(OrderDirectionStrict, Query)
Query.OrderBy(OrderDirectionStrict, QueryColumnExpression)
Query.OrderBy(OrderDirectionStrict, IQueryColumnExpressionConvertible)
Query.OrderByAsc(String)
Query.OrderByAsc(String, String)
Query.OrderByAsc(Select)
Query.OrderByAsc(Query)
Query.OrderByAsc(QueryColumnExpression)
Query.OrderByAsc(IQueryColumnExpressionConvertible)
Query.OrderByDesc(String)
Query.OrderByDesc(String, String)
Query.OrderByDesc(Select)
Query.OrderByDesc(Query)
Query.OrderByDesc(QueryColumnExpression)
Query.OrderByDesc(IQueryColumnExpressionConvertible)
Query.GroupBy(String)
Query.GroupBy(String, String)
Query.GroupBy(QueryColumnExpression)
Query.GroupBy(IQueryColumnExpressionConvertible)
Query.Having()
Query.Having(String)
Query.Having(String, String)
Query.Having(Select)
Query.Having(Query)
Query.Having(IQueryColumnExpressionConvertible)
Query.Having(QueryParameter)
Query.Having(QueryColumnExpression)
Query.Union(Select)
Query.Union(Query)
Query.UnionAll(Select)
Query.UnionAll(Query)
Query.ResetCachedSqlText()
Query.SetParameterValue(String, Object)
Query.DBEngine
Query.UserConnection
Query.RowCount
Query.Parameters
Query.HasParameters
Query.BuildParametersAsValue
Query.Joins
Query.HasJoins
Query.Condition
Query.HasCondition
Query.HavingCondition
Query.HasHavingCondition
Query.OrderByItems
Query.HasOrderByItems
Query.GroupByItems
Query.HasGroupByItems
Query.UnionQueries
Query.HasUnionQueries
Query.IsUnionTypeAll
Query.IsCacheEnabled
Query.CachedSqlText
Query.Hints
Query.HasHints
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 class Select : Query, IParametrizedQuery, ISqlGenerating, ICacheableQuery, ICloneable, IDBReadableCommand

Constructors

Select(Select)

Initializes a new Select instance that is a clone of the passed-in query.

Declaration
public Select(Select source)
Parameters
Type Name Description
Select source

The data select query whose clone is being created.

Select(UserConnection)

Initialises a new instance of Select, using given user's connection.

Declaration
public Select(UserConnection userConnection)
Parameters
Type Name Description
UserConnection userConnection

User's connection.

Select(UserConnection, CancellationToken)

Initialises a new instance of Select, using given user's connection and a System.Threading.CancellationToken.

Declaration
public Select(UserConnection userConnection, CancellationToken cancellationToken)
Parameters
Type Name Description
UserConnection userConnection

User's connection.

System.Threading.CancellationToken cancellationToken

Cancellation token to be passed to requests.

Properties

CanReadUncommitedData

Determines whether the query results will include the data for which the transaction is not completed.

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

Columns

Collection of expressions of query columns.

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

ConnectBySelect

ConnectBy select. Using for pageable hierarchical queries. Select.

Declaration
public Select ConnectBySelect { get; set; }
Property Value
Type Description
Select

HierarchicalOptions

Parameters for building hierarchical queries. HierarchicalSelectOptions.

Declaration
public HierarchicalSelectOptions HierarchicalOptions { get; set; }
Property Value
Type Description
HierarchicalSelectOptions

IsDistinct

Determines whether the query returns only unique records.

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

OffsetFetchPaging

Determines if offset-fetch paging is using.

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

PageableOptions

Parameters for paging query results. PageableSelectOptions.

Declaration
public PageableSelectOptions PageableOptions { get; set; }
Property Value
Type Description
PageableSelectOptions

QueryKind

Query kind, that is used to request special executor.

Declaration
public QueryKind QueryKind { get; }
Property Value
Type Description
QueryKind

QueryOptimize

Additional information about the query, that can by use to optimization DBEngine.

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

RowsOffset

Number of rows to skip.

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

SourceExpression

The expression of the query data source.

Declaration
public QuerySourceExpression SourceExpression { get; set; }
Property Value
Type Description
QuerySourceExpression

Methods

AddColumn(QueryColumnExpression)

Declaration
protected void AddColumn(QueryColumnExpression columnExpression)
Parameters
Type Name Description
QueryColumnExpression columnExpression

AddFrom(QuerySourceExpression)

Declaration
protected void AddFrom(QuerySourceExpression sourceExpression)
Parameters
Type Name Description
QuerySourceExpression sourceExpression

As(String)

Adds the specified alias for the last specified query expression.

Declaration
public Select As(string alias)
Parameters
Type Name Description
System.String alias

The query expression alias.

Returns
Type Description
Select

The current Select instance.

Exceptions
Type Condition
InvalidObjectStateException

If the method is called before calling one of the [From] or [Columns] methods.

BuildSqlText(StringBuilder)

Generates the query text, using the specified System.Text.StringBuilder instance.

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

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

Overrides
Query.BuildSqlText(StringBuilder)

Clone()

Creates the clone of the current Select instance.

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

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

Overrides
Query.Clone()

Column(String)

In the collection of column expressions of the current query, adds an expression for the column with the specified alias.

Declaration
public Select Column(string sourceColumnAlias)
Parameters
Type Name Description
System.String sourceColumnAlias

The alias of the column.

Returns
Type Description
Select

The current Select instance.

Column(String, String)

In the collection of column expressions of the current query, adds an expression for the column with the specified alias from the specified source.

Declaration
public Select Column(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
Select

The current Select instance.

Column(IQueryColumnExpressionConvertible)

Adds the passed-in expression in the current collection of column expressions.

Declaration
public Select Column(IQueryColumnExpressionConvertible expression)
Parameters
Type Name Description
IQueryColumnExpressionConvertible expression

Expression.

Returns
Type Description
Select

The current Select instance.

Column(Query)

In the collection of column expressions of the current query, adds an expression for the passed-in random subquery.

Declaration
public Select Column(Query subSelectQuery)
Parameters
Type Name Description
Query subSelectQuery

Random subquery.

Returns
Type Description
Select

The current Select instance.

Column(QueryCase)

In the collection of column expressions of the current query, adds an expression for the passed-in Case operator.

Declaration
public Select Column(QueryCase queryCase)
Parameters
Type Name Description
QueryCase queryCase

The Case query operator.

Returns
Type Description
Select

The current Select instance.

Column(QueryColumnExpression)

Adds the passed-in column expression in the current collection of column expressions.

Declaration
public Select Column(QueryColumnExpression columnExpression)
Parameters
Type Name Description
QueryColumnExpression columnExpression

The query column expression.

Returns
Type Description
Select

The current Select instance.

Column(QueryParameter)

In the current collection of column expressions, adds the expressions for the passed-in query parameter.

Declaration
public Select Column(QueryParameter queryParameter)
Parameters
Type Name Description
QueryParameter queryParameter

The query parameter.

Returns
Type Description
Select

The current Select instance.

Column(Select)

In the collection of column expressions of the current query, adds an expression for the passed-in select subquery.

Declaration
public Select Column(Select subSelect)
Parameters
Type Name Description
Select subSelect

The select subquery.

Returns
Type Description
Select

The current Select instance.

CrossJoin(String)

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

Declaration
public Select CrossJoin(string schemaName)
Parameters
Type Name Description
System.String schemaName

Name of the schema to associate.

Returns
Type Description
Select

The current Select instance.

CrossJoin(Query)

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

Declaration
public Select CrossJoin(Query subSelectQuery)
Parameters
Type Name Description
Query subSelectQuery

Random subquery.

Returns
Type Description
Select

The current Select instance.

CrossJoin(QuerySourceExpression)

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

Declaration
public Select CrossJoin(QuerySourceExpression sourceExpression)
Parameters
Type Name Description
QuerySourceExpression sourceExpression

Expression for the data source being attached.

Returns
Type Description
Select

The current Select instance.

CrossJoin(Select)

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

Declaration
public Select CrossJoin(Select subSelect)
Parameters
Type Name Description
Select subSelect

The select subquery.

Returns
Type Description
Select

The current Select instance.

Distinct()

To the current select query, adds the key word Distinct.

Declaration
public Select Distinct()
Returns
Type Description
Select

The current Select instance.

EnsureSpecialDBExecutor(UserConnection, QueryKind)

Declaration
protected DBExecutor EnsureSpecialDBExecutor(UserConnection userConnection, QueryKind queryKind)
Parameters
Type Name Description
UserConnection userConnection
QueryKind queryKind
Returns
Type Description
DBExecutor

ExecuteReader(DBExecutor)

Executes SQL query using given instance of DBExecutor and returns System.Data.IDataReader for the resulting set of records.

Declaration
public IDataReader ExecuteReader(DBExecutor dbExecutor)
Parameters
Type Name Description
DBExecutor dbExecutor

Instance of DBExecutor, to be used for SQL query.

Returns
Type Description
System.Data.IDataReader

Instance implementing System.Data.IDataReader for the resulting set of records.

ExecuteReader(DBExecutor, CommandBehavior)

Executes SQL query using given instance of DBExecutor and returns System.Data.IDataReader for the resulting set of records.

Declaration
public IDataReader ExecuteReader(DBExecutor dbExecutor, CommandBehavior behavior)
Parameters
Type Name Description
DBExecutor dbExecutor

Instance of DBExecutor, to be used for SQL query.

System.Data.CommandBehavior behavior

Provides a description of the results of the query and its effect on the database.

Returns
Type Description
System.Data.IDataReader

Instance implementing System.Data.IDataReader for the resulting set of records.

ExecuteReader(Select.ExecuteReaderReadMethod)

Executes SQL query and executes delegate Select.ExecuteReaderReadMethod for each row of the resulting set of records.

Declaration
public void ExecuteReader(Select.ExecuteReaderReadMethod readMethod)
Parameters
Type Name Description
Select.ExecuteReaderReadMethod readMethod

ExecuteScalar<TResult>()

Executes the query and returns the first column of the first row in the result set returned by the query.

Declaration
public TResult ExecuteScalar<TResult>()
Returns
Type Description
TResult

The first row in the result set of type TResult.

Type Parameters
Name Description
TResult

The type of the return value.

ExecuteScalar<TResult>(DBExecutor)

Executes the current select query and returns the typed first column of the first record of the resulting set, using the passed-in DBExecutor instance.

Declaration
public TResult ExecuteScalar<TResult>(DBExecutor dbExecutor)
Parameters
Type Name Description
DBExecutor dbExecutor

The DBExecutor instance used to query the database.

Returns
Type Description
TResult

The first column of the first record in the resulting dataset of the TResult type.

Type Parameters
Name Description
TResult

The return type of the column value.

ExecuteScalarAsync<TResult>()

An asynchronous version of ExecuteScalar, which executes the query and returns the first column of the first row in the result set returned by the query.

Declaration
public Task<TResult> ExecuteScalarAsync<TResult>()
Returns
Type Description
System.Threading.Tasks.Task<TResult>

A task representing the asynchronous operation.

Type Parameters
Name Description
TResult

The type of the return value.

From(String)

Adds the schema with the specified name as the data source expression of the current query.

Declaration
public Select From(string schemaName)
Parameters
Type Name Description
System.String schemaName

Name of the schema.

Returns
Type Description
Select

The current Select instance.

From(Query)

Adds the expression for the transferred arbitrary subquery as the data source expression of the current query.

Declaration
public Select From(Query subSelectQuery)
Parameters
Type Name Description
Query subSelectQuery

Random subquery.

Returns
Type Description
Select

The current Select instance.

From(QuerySourceExpression)

Adds the passed-in expression as the data source expression of the current query.

Declaration
public Select From(QuerySourceExpression sourceExpression)
Parameters
Type Name Description
QuerySourceExpression sourceExpression

The expression of the query data source.

Returns
Type Description
Select

The current Select instance.

From(Select)

Adds the expression for the passed-in select subquery as the data source expression of the current query.

Declaration
public Select From(Select subSelect)
Parameters
Type Name Description
Select subSelect

The select subquery.

Returns
Type Description
Select

The current Select instance.

GetSqlText()

Returns the SQL text of the current query.

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

The SQL text of the current query.

Overrides
Query.GetSqlText()

GetUsingParameters()

Returns the collection of parameters used by the query.

Declaration
public override QueryParameterCollection GetUsingParameters()
Returns
Type Description
QueryParameterCollection

Collection of parameters used by the query.

Overrides
Query.GetUsingParameters()

OffsetFetch(Int32, Int32)

Adds offset-fetch clause to select.

Declaration
public Select OffsetFetch(int rowsOffset, int rowsCount)
Parameters
Type Name Description
System.Int32 rowsOffset

Number of rows to skip.

System.Int32 rowsCount

Number of rows to select.

Returns
Type Description
Select

Modified select.

Top(Int32)

Specifies the number of first records returned by the resulting dataset.

Declaration
public Select Top(int rowCount)
Parameters
Type Name Description
System.Int32 rowCount

Number of first records of the resulting set.

Returns
Type Description
Select

The current Select instance.

ToPageable(PageableSelectOptions)

Transforms the current query into a query that has an option of the paged output with the specified parameters.

Declaration
public Select ToPageable(PageableSelectOptions options)
Parameters
Type Name Description
PageableSelectOptions options

Parameters of the paged output of the query results.

Returns
Type Description
Select

The data select query with the paged output.

Implements

IParametrizedQuery
ISqlGenerating
ICacheableQuery
System.ICloneable
IDBReadableCommand

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)
HintsHelper.WithHints(Select, BaseHint[])
HintsHelper.SpecifyNoLockHints(Select, Boolean)
QueryUtilities.AddColumnLocalization(Select, String, String, String, Guid)
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