Show / Hide Table of Contents

Class DBExecutor

Database query executor.

Inheritance
System.Object
DBExecutor
MSSqlExecutor
OracleExecutor
OracleManagedExecutor
PostgreSqlExecutor
Implements
System.IDisposable
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 DBExecutor : INotifyOnDisposed, IDisposable

Constructors

DBExecutor(UserConnection)

Declaration
protected DBExecutor(UserConnection userConnection)
Parameters
Type Name Description
UserConnection userConnection

DBExecutor(UserConnection, QueryKind)

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

Properties

BinaryPackageSize

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

ClientSettings

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

CommandTimeout

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

ConnectionString

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

ConnectionStrings

Declaration
protected static Dictionary<QueryKind, string> ConnectionStrings { get; set; }
Property Value
Type Description
System.Collections.Generic.Dictionary<QueryKind, System.String>

ConnetionDepth

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

CurrentSchemaName

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

DBCommandSettings

Declaration
public static DBSectionCollection DBCommandSettings { get; set; }
Property Value
Type Description
DBSectionCollection

DBConnection

Declaration
protected DbConnection DBConnection { get; }
Property Value
Type Description
System.Data.Common.DbConnection

DBSessionSettings

Declaration
public static DBSectionCollection DBSessionSettings { get; set; }
Property Value
Type Description
DBSectionCollection

EnableSqlLog

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

EnsuredExecutors

Declaration
protected static ConcurrentDictionary<int, (DateTime date, string callStack)> EnsuredExecutors { get; }
Property Value
Type Description
System.Collections.Concurrent.ConcurrentDictionary<System.Int32, System.ValueTuple<System.DateTime, System.String>>

IsOffsetPagingFeatureEnabled

Declaration
protected virtual bool IsOffsetPagingFeatureEnabled { get; }
Property Value
Type Description
System.Boolean

Logger

Declaration
protected ILog Logger { get; }
Property Value
Type Description
Common.Logging.ILog

OpenedConnections

Declaration
protected static ConcurrentDictionary<int, (DateTime date, string callStack)> OpenedConnections { get; }
Property Value
Type Description
System.Collections.Concurrent.ConcurrentDictionary<System.Int32, System.ValueTuple<System.DateTime, System.String>>

OpenedTransactions

Declaration
protected static ConcurrentDictionary<int, (DateTime date, string callStack)> OpenedTransactions { get; }
Property Value
Type Description
System.Collections.Concurrent.ConcurrentDictionary<System.Int32, System.ValueTuple<System.DateTime, System.String>>

QueryKind

Declaration
protected QueryKind QueryKind { get; set; }
Property Value
Type Description
QueryKind

ReplicaConnectionString

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

ServerVersion

Server version.

Declaration
protected virtual Version ServerVersion { get; }
Property Value
Type Description
System.Version

TransactionDepth

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

UseDaylightSavingTimeSupport

Declaration
protected virtual bool UseDaylightSavingTimeSupport { get; }
Property Value
Type Description
System.Boolean

UserConnection

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

Methods

BeginTransaction(IsolationLevel)

Declaration
protected virtual DbTransaction BeginTransaction(IsolationLevel isolationLevel)
Parameters
Type Name Description
System.Data.IsolationLevel isolationLevel
Returns
Type Description
System.Data.Common.DbTransaction

BuildConnectionString(String, String)

Declaration
protected abstract string BuildConnectionString(string userName, string password)
Parameters
Type Name Description
System.String userName
System.String password
Returns
Type Description
System.String

Close()

Declaration
public void Close()

CommitTransaction()

Commits the database transaction.

Declaration
public virtual void CommitTransaction()

DBParametersToQueryParameters(DbParameterCollection, QueryParameterCollection)

Declaration
protected abstract void DBParametersToQueryParameters(DbParameterCollection dbParameters, QueryParameterCollection queryParameters)
Parameters
Type Name Description
System.Data.Common.DbParameterCollection dbParameters
QueryParameterCollection queryParameters

Dispose()

Declaration
public void Dispose()

Dispose(Boolean)

Releases all resources used by the DBExecutor

Declaration
protected void Dispose(bool disposing)
Parameters
Type Name Description
System.Boolean disposing

true to release both managed and unmanaged resources; false to release only unmanaged resources.

Execute(String)

Executes a SQL statement against a connection object.

Declaration
[Obsolete("This method is obsolete. Use IDBCommand.Execute instead.")]
public virtual int Execute(string sqlText)
Parameters
Type Name Description
System.String sqlText

SQL command text.

Returns
Type Description
System.Int32

The number of rows affected.

Execute(String, QueryParameterCollection)

Executes a SQL statement with parameters, if any, against a connection object.

Declaration
[Obsolete("This method is obsolete. Use IDBCommand.Execute instead.")]
public virtual int Execute(string sqlText, QueryParameterCollection queryParameters)
Parameters
Type Name Description
System.String sqlText

SQL command text.

QueryParameterCollection queryParameters

Query parameters that will be converted into System.Data.Common.DbParameterCollection

Returns
Type Description
System.Int32

The number of rows affected.

ExecuteBatches(String)

Declaration
[Obsolete("This method is obsolete. Use IDBCommand.Execute instead.")]
public void ExecuteBatches(string sqlText)
Parameters
Type Name Description
System.String sqlText

ExecuteCommand<TResult>(Func<DbCommand, TResult>, String, QueryParameterCollection)

Declaration
protected TResult ExecuteCommand<TResult>(Func<DbCommand, TResult> commandExecutionCallback, string sqlText, QueryParameterCollection queryParameters)
Parameters
Type Name Description
System.Func<System.Data.Common.DbCommand, TResult> commandExecutionCallback
System.String sqlText
QueryParameterCollection queryParameters
Returns
Type Description
TResult
Type Parameters
Name Description
TResult

ExecuteCommand<TResult>(Func<DbCommand, TResult>, String, QueryParameterCollection, CancellationToken)

Declaration
protected TResult ExecuteCommand<TResult>(Func<DbCommand, TResult> commandExecutionCallback, string sqlText, QueryParameterCollection queryParameters, CancellationToken cancellationToken)
Parameters
Type Name Description
System.Func<System.Data.Common.DbCommand, TResult> commandExecutionCallback
System.String sqlText
QueryParameterCollection queryParameters
System.Threading.CancellationToken cancellationToken
Returns
Type Description
TResult
Type Parameters
Name Description
TResult

ExecuteCommandAsync<TResult>(Func<DbCommand, Task<TResult>>, String, QueryParameterCollection)

Declaration
protected Task<TResult> ExecuteCommandAsync<TResult>(Func<DbCommand, Task<TResult>> commandExecutionCallback, string sqlText, QueryParameterCollection queryParameters)
Parameters
Type Name Description
System.Func<System.Data.Common.DbCommand, System.Threading.Tasks.Task<TResult>> commandExecutionCallback
System.String sqlText
QueryParameterCollection queryParameters
Returns
Type Description
System.Threading.Tasks.Task<TResult>
Type Parameters
Name Description
TResult

ExecuteCommandAsync<TResult>(Func<DbCommand, Task<TResult>>, String, QueryParameterCollection, CancellationToken)

Declaration
protected Task<TResult> ExecuteCommandAsync<TResult>(Func<DbCommand, Task<TResult>> commandExecutionCallbackAsync, string sqlText, QueryParameterCollection queryParameters, CancellationToken cancellationToken)
Parameters
Type Name Description
System.Func<System.Data.Common.DbCommand, System.Threading.Tasks.Task<TResult>> commandExecutionCallbackAsync
System.String sqlText
QueryParameterCollection queryParameters
System.Threading.CancellationToken cancellationToken
Returns
Type Description
System.Threading.Tasks.Task<TResult>
Type Parameters
Name Description
TResult

ExecuteReader(String)

Sends SQL command text to the connection, and builds a DataReader.

Declaration
[Obsolete("This method is obsolete. Use IDBReadableCommand.ExecuteReader instead.")]
public virtual IDataReader ExecuteReader(string sqlText)
Parameters
Type Name Description
System.String sqlText

SQL command text.

Returns
Type Description
System.Data.IDataReader

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

ExecuteReader(String, CancellationToken)

Sends SQL command text to the connection, and builds a DataReader. Command execution can be cancelled with the token.

Declaration
[Obsolete("This method is obsolete. Use IDBReadableCommand.ExecuteReader instead.")]
public virtual IDataReader ExecuteReader(string sqlText, CancellationToken cancellationToken)
Parameters
Type Name Description
System.String sqlText

SQL command text.

System.Threading.CancellationToken cancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
System.Data.IDataReader

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

ExecuteReader(String, QueryParameterCollection)

Sends SQL command text and its parameters to the connection, and builds a DataReader.

Declaration
[Obsolete("This method is obsolete. Use IDBReadableCommand.ExecuteReader instead.")]
public virtual IDataReader ExecuteReader(string sqlText, QueryParameterCollection queryParameters)
Parameters
Type Name Description
System.String sqlText

SQL command text.

QueryParameterCollection queryParameters

Query parameters that will be converted into System.Data.Common.DbParameterCollection

Returns
Type Description
System.Data.IDataReader

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

ExecuteReader(String, QueryParameterCollection, CommandBehavior)

Sends SQL command text and its parameters to the connection, and builds a DataReader using one of the CommandBehavior values.

Declaration
[Obsolete("This method is obsolete. Use IDBReadableCommand.ExecuteReader instead.")]
public virtual IDataReader ExecuteReader(string sqlText, QueryParameterCollection queryParameters, CommandBehavior behavior)
Parameters
Type Name Description
System.String sqlText

SQL command text.

QueryParameterCollection queryParameters

Query parameters that will be converted into System.Data.Common.DbParameterCollection

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(String, QueryParameterCollection, CommandBehavior, CancellationToken)

Sends SQL command text and its parameters to the connection, and builds a DataReader using one of the CommandBehavior values. Command execution can be cancelled with the token.

Declaration
[Obsolete("This method is obsolete. Use IDBReadableCommand.ExecuteReader instead.")]
public virtual IDataReader ExecuteReader(string sqlText, QueryParameterCollection queryParameters, CommandBehavior behavior, CancellationToken cancellationToken)
Parameters
Type Name Description
System.String sqlText

SQL command text.

QueryParameterCollection queryParameters

Query parameters that will be converted into System.Data.Common.DbParameterCollection.

System.Data.CommandBehavior behavior

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

System.Threading.CancellationToken cancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
System.Data.IDataReader

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

ExecuteReader(String, QueryParameterCollection, CancellationToken)

Sends SQL command text and its parameters to the connection, and builds a DataReader. Command execution can be cancelled with the token.

Declaration
[Obsolete("This method is obsolete. Use IDBReadableCommand.ExecuteReader instead.")]
public virtual IDataReader ExecuteReader(string sqlText, QueryParameterCollection queryParameters, CancellationToken cancellationToken)
Parameters
Type Name Description
System.String sqlText

SQL command text.

QueryParameterCollection queryParameters

Query parameters that will be converted into System.Data.Common.DbParameterCollection

System.Threading.CancellationToken cancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
System.Data.IDataReader

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

ExecuteScalar<TResult>(String)

Executes a SQL statement and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.

Declaration
[Obsolete("This method is obsolete. Use IDBReadableCommand.ExecuteScalar instead.")]
public virtual TResult ExecuteScalar<TResult>(string sqlText)
Parameters
Type Name Description
System.String sqlText

SQL command text.

Returns
Type Description
TResult

Scalar value of the given result type.

Type Parameters
Name Description
TResult

ExecuteScalar<TResult>(String, QueryParameterCollection)

Executes a SQL statement with parameters, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.

Declaration
[Obsolete("This method is obsolete. Use IDBReadableCommand.ExecuteScalar instead.")]
public virtual TResult ExecuteScalar<TResult>(string sqlText, QueryParameterCollection queryParameters)
Parameters
Type Name Description
System.String sqlText

SQL command text.

QueryParameterCollection queryParameters

Query parameters that will be converted into System.Data.Common.DbParameterCollection.

Returns
Type Description
TResult

Scalar value of the given result type.

Type Parameters
Name Description
TResult

FailoverExecute<TResult>(DbCommand, Func<TResult>)

Declaration
protected virtual TResult FailoverExecute<TResult>(DbCommand command, Func<TResult> func)
Parameters
Type Name Description
System.Data.Common.DbCommand command
System.Func<TResult> func
Returns
Type Description
TResult
Type Parameters
Name Description
TResult

FailoverExecute<TResult>(DbCommand, Func<CommandBehavior, TResult>, CommandBehavior)

Declaration
[Obsolete("7.12.3 | Method is not in use and will be removed in upcoming builds")]
protected virtual TResult FailoverExecute<TResult>(DbCommand command, Func<CommandBehavior, TResult> func, CommandBehavior behavior)
Parameters
Type Name Description
System.Data.Common.DbCommand command
System.Func<System.Data.CommandBehavior, TResult> func
System.Data.CommandBehavior behavior
Returns
Type Description
TResult
Type Parameters
Name Description
TResult

FailoverExecuteAsync<TResult>(DbCommand, Func<Task<TResult>>)

Declaration
protected virtual Task<TResult> FailoverExecuteAsync<TResult>(DbCommand command, Func<Task<TResult>> func)
Parameters
Type Name Description
System.Data.Common.DbCommand command
System.Func<System.Threading.Tasks.Task<TResult>> func
Returns
Type Description
System.Threading.Tasks.Task<TResult>
Type Parameters
Name Description
TResult

FailoverExecuteReader(DbCommand, Func<CommandBehavior, IDataReader>, CommandBehavior)

Declaration
protected virtual IDataReader FailoverExecuteReader(DbCommand command, Func<CommandBehavior, IDataReader> func, CommandBehavior behavior)
Parameters
Type Name Description
System.Data.Common.DbCommand command
System.Func<System.Data.CommandBehavior, System.Data.IDataReader> func
System.Data.CommandBehavior behavior
Returns
Type Description
System.Data.IDataReader

FailoverExecuteReader(DbCommand, Func<IDataReader>)

Declaration
protected virtual IDataReader FailoverExecuteReader(DbCommand command, Func<IDataReader> func)
Parameters
Type Name Description
System.Data.Common.DbCommand command
System.Func<System.Data.IDataReader> func
Returns
Type Description
System.Data.IDataReader

FailoverExecuteReaderAsync(DbCommand, Func<Task<IDataReader>>)

Declaration
protected virtual Task<IDataReader> FailoverExecuteReaderAsync(DbCommand command, Func<Task<IDataReader>> func)
Parameters
Type Name Description
System.Data.Common.DbCommand command
System.Func<System.Threading.Tasks.Task<System.Data.IDataReader>> func
Returns
Type Description
System.Threading.Tasks.Task<System.Data.IDataReader>

GetConnectionPoolInfo()

Declaration
protected virtual (int busyConnectionCount, int maxPoolSize)GetConnectionPoolInfo()
Returns
Type Description
System.ValueTuple<System.Int32, System.Int32>

GetConnectionString(QueryKind)

Declaration
protected virtual string GetConnectionString(QueryKind kind)
Parameters
Type Name Description
QueryKind kind
Returns
Type Description
System.String

GetDataReader(IDataReader, DbCommand)

Wraps data reader into logging proxy if logging is enabled.

Declaration
protected IDataReader GetDataReader(IDataReader dataReader, DbCommand command)
Parameters
Type Name Description
System.Data.IDataReader dataReader

The data reader.

System.Data.Common.DbCommand command

The command.

Returns
Type Description
System.Data.IDataReader

GetTriggerIsEnabled(String)

Returns whether the trigger is enabled.

Declaration
protected virtual bool GetTriggerIsEnabled(string triggerName)
Parameters
Type Name Description
System.String triggerName

Trigger name.

Returns
Type Description
System.Boolean

InitConnectionStrings()

Declaration
protected virtual void InitConnectionStrings()

InitilizeConnectionAfterOpen(DbConnection)

Declaration
protected abstract void InitilizeConnectionAfterOpen(DbConnection dbConnection)
Parameters
Type Name Description
System.Data.Common.DbConnection dbConnection

InternalExecute(String)

Executes a SQL statement against a connection object.

Declaration
protected virtual int InternalExecute(string sqlText)
Parameters
Type Name Description
System.String sqlText

SQL command text.

Returns
Type Description
System.Int32

The number of rows affected.

InternalExecute(String, QueryParameterCollection)

Executes a SQL statement with parameters, if any, against a connection object.

Declaration
protected virtual int InternalExecute(string sqlText, QueryParameterCollection queryParameters)
Parameters
Type Name Description
System.String sqlText

SQL command text.

QueryParameterCollection queryParameters

Query parameters that will be converted into System.Data.Common.DbParameterCollection

Returns
Type Description
System.Int32

The number of rows affected.

InternalExecuteAsync(String)

An asynchronous version of InternalExecute, which executes a SQL statement against a connection object.

Declaration
protected virtual Task<int> InternalExecuteAsync(string sqlText)
Parameters
Type Name Description
System.String sqlText

SQL command text.

Returns
Type Description
System.Threading.Tasks.Task<System.Int32>

The number of rows affected.

InternalExecuteAsync(String, QueryParameterCollection)

An asynchronous version of InternalExecute, which executes a SQL statement with parameters, if any, against a connection object.

Declaration
protected virtual Task<int> InternalExecuteAsync(string sqlText, QueryParameterCollection queryParameters)
Parameters
Type Name Description
System.String sqlText

SQL command text.

QueryParameterCollection queryParameters

Query parameters that will be converted into System.Data.Common.DbParameterCollection

Returns
Type Description
System.Threading.Tasks.Task<System.Int32>

The number of rows affected.

InternalExecuteReader(String)

Sends SQL command text to the connection, and builds a DataReader.

Declaration
protected virtual IDataReader InternalExecuteReader(string sqlText)
Parameters
Type Name Description
System.String sqlText

SQL command text.

Returns
Type Description
System.Data.IDataReader

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

InternalExecuteReader(String, CancellationToken)

Sends SQL command text to the connection, and builds a DataReader. Command execution can be cancelled with the token.

Declaration
protected virtual IDataReader InternalExecuteReader(string sqlText, CancellationToken cancellationToken)
Parameters
Type Name Description
System.String sqlText

SQL command text.

System.Threading.CancellationToken cancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
System.Data.IDataReader

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

InternalExecuteReader(String, QueryParameterCollection)

Sends SQL command text and its parameters to the connection, and builds a DataReader.

Declaration
protected virtual IDataReader InternalExecuteReader(string sqlText, QueryParameterCollection queryParameters)
Parameters
Type Name Description
System.String sqlText

SQL command text.

QueryParameterCollection queryParameters

Query parameters that will be converted into System.Data.Common.DbParameterCollection

Returns
Type Description
System.Data.IDataReader

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

InternalExecuteReader(String, QueryParameterCollection, CommandBehavior)

Sends SQL command text and its parameters to the connection, and builds a DataReader using one of the CommandBehavior values.

Declaration
protected virtual IDataReader InternalExecuteReader(string sqlText, QueryParameterCollection queryParameters, CommandBehavior behavior)
Parameters
Type Name Description
System.String sqlText

SQL command text.

QueryParameterCollection queryParameters

Query parameters that will be converted into System.Data.Common.DbParameterCollection

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.

InternalExecuteReader(String, QueryParameterCollection, CommandBehavior, CancellationToken)

Sends SQL command text and its parameters to the connection, and builds a DataReader using one of the CommandBehavior values. Command execution can be cancelled with the token.

Declaration
protected virtual IDataReader InternalExecuteReader(string sqlText, QueryParameterCollection queryParameters, CommandBehavior behavior, CancellationToken cancellationToken)
Parameters
Type Name Description
System.String sqlText

SQL command text.

QueryParameterCollection queryParameters

Query parameters that will be converted into System.Data.Common.DbParameterCollection.

System.Data.CommandBehavior behavior

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

System.Threading.CancellationToken cancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
System.Data.IDataReader

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

InternalExecuteReader(String, QueryParameterCollection, CancellationToken)

Sends SQL command text and its parameters to the connection, and builds a DataReader. Command execution can be cancelled with the token.

Declaration
protected virtual IDataReader InternalExecuteReader(string sqlText, QueryParameterCollection queryParameters, CancellationToken cancellationToken)
Parameters
Type Name Description
System.String sqlText

SQL command text.

QueryParameterCollection queryParameters

Query parameters that will be converted into System.Data.Common.DbParameterCollection

System.Threading.CancellationToken cancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
System.Data.IDataReader

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

InternalExecuteReaderAsync(String)

An asynchronous version of InternalExecuteReader, which sends SQL command text to the connection, and builds a DataReader.

Declaration
protected virtual Task<IDataReader> InternalExecuteReaderAsync(string sqlText)
Parameters
Type Name Description
System.String sqlText

SQL command text.

Returns
Type Description
System.Threading.Tasks.Task<System.Data.IDataReader>

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

InternalExecuteReaderAsync(String, CancellationToken)

An asynchronous version of InternalExecuteReader, which sends SQL command text to the connection, and builds a DataReader. Command execution can be cancelled with the token.

Declaration
protected virtual Task<IDataReader> InternalExecuteReaderAsync(string sqlText, CancellationToken cancellationToken)
Parameters
Type Name Description
System.String sqlText

SQL command text.

System.Threading.CancellationToken cancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
System.Threading.Tasks.Task<System.Data.IDataReader>

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

InternalExecuteReaderAsync(String, QueryParameterCollection)

An asynchronous version of InternalExecuteReader, which sends SQL command text and its parameters to the connection, and builds a DataReader.

Declaration
protected virtual Task<IDataReader> InternalExecuteReaderAsync(string sqlText, QueryParameterCollection queryParameters)
Parameters
Type Name Description
System.String sqlText

SQL command text.

QueryParameterCollection queryParameters

Query parameters that will be converted into System.Data.Common.DbParameterCollection

Returns
Type Description
System.Threading.Tasks.Task<System.Data.IDataReader>

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

InternalExecuteReaderAsync(String, QueryParameterCollection, CommandBehavior)

An asynchronous version of InternalExecuteReader, which sends SQL command text and its parameters to the connection, and builds a DataReader using one of the CommandBehavior values.

Declaration
protected virtual Task<IDataReader> InternalExecuteReaderAsync(string sqlText, QueryParameterCollection queryParameters, CommandBehavior behavior)
Parameters
Type Name Description
System.String sqlText

SQL command text.

QueryParameterCollection queryParameters

Query parameters that will be converted into System.Data.Common.DbParameterCollection

System.Data.CommandBehavior behavior

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

Returns
Type Description
System.Threading.Tasks.Task<System.Data.IDataReader>

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

InternalExecuteReaderAsync(String, QueryParameterCollection, CommandBehavior, CancellationToken)

An asynchronous version of InternalExecuteReader, which sends SQL command text and its parameters to the connection, and builds a DataReader using one of the CommandBehavior values. Command execution can be cancelled with the token.

Declaration
protected virtual Task<IDataReader> InternalExecuteReaderAsync(string sqlText, QueryParameterCollection queryParameters, CommandBehavior behavior, CancellationToken cancellationToken)
Parameters
Type Name Description
System.String sqlText

SQL command text.

QueryParameterCollection queryParameters

Query parameters that will be converted into System.Data.Common.DbParameterCollection.

System.Data.CommandBehavior behavior

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

System.Threading.CancellationToken cancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
System.Threading.Tasks.Task<System.Data.IDataReader>

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

InternalExecuteReaderAsync(String, QueryParameterCollection, CancellationToken)

An asynchronous version of InternalExecuteReader, which sends SQL command text and its parameters to the connection, and builds a DataReader. Command execution can be cancelled with the token.

Declaration
protected virtual Task<IDataReader> InternalExecuteReaderAsync(string sqlText, QueryParameterCollection queryParameters, CancellationToken cancellationToken)
Parameters
Type Name Description
System.String sqlText

SQL command text.

QueryParameterCollection queryParameters

Query parameters that will be converted into System.Data.Common.DbParameterCollection

System.Threading.CancellationToken cancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
System.Threading.Tasks.Task<System.Data.IDataReader>

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

InternalExecuteScalar<TResult>(String)

Executes a SQL statement and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.

Declaration
protected virtual TResult InternalExecuteScalar<TResult>(string sqlText)
Parameters
Type Name Description
System.String sqlText

SQL command text.

Returns
Type Description
TResult

Scalar value of the given result type.

Type Parameters
Name Description
TResult

InternalExecuteScalar<TResult>(String, QueryParameterCollection)

Executes a SQL statement with parameters, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.

Declaration
protected virtual TResult InternalExecuteScalar<TResult>(string sqlText, QueryParameterCollection queryParameters)
Parameters
Type Name Description
System.String sqlText

SQL command text.

QueryParameterCollection queryParameters

Query parameters that will be converted into System.Data.Common.DbParameterCollection.

Returns
Type Description
TResult

Scalar value of the given result type.

Type Parameters
Name Description
TResult

InternalExecuteScalarAsync<TResult>(String)

An asynchronous version of InternalExecuteScalar, which executes a SQL statement and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.

Declaration
protected virtual Task<TResult> InternalExecuteScalarAsync<TResult>(string sqlText)
Parameters
Type Name Description
System.String sqlText

SQL command text.

Returns
Type Description
System.Threading.Tasks.Task<TResult>

Scalar value of the given result type.

Type Parameters
Name Description
TResult

InternalExecuteScalarAsync<TResult>(String, QueryParameterCollection)

An asynchronous version of InternalExecuteScalar, which executes a SQL statement with parameters.

Declaration
protected virtual Task<TResult> InternalExecuteScalarAsync<TResult>(string sqlText, QueryParameterCollection queryParameters)
Parameters
Type Name Description
System.String sqlText

SQL command text.

QueryParameterCollection queryParameters

Query parameters that will be converted into System.Data.Common.DbParameterCollection.

Returns
Type Description
System.Threading.Tasks.Task<TResult>

Scalar value of the given result type.

Type Parameters
Name Description
TResult

NewCommand()

Declaration
protected abstract DbCommand NewCommand()
Returns
Type Description
System.Data.Common.DbCommand

NewConnection()

Declaration
protected abstract DbConnection NewConnection()
Returns
Type Description
System.Data.Common.DbConnection

PingDB(UserConnection)

Declaration
public static bool PingDB(UserConnection userConnection)
Parameters
Type Name Description
UserConnection userConnection
Returns
Type Description
System.Boolean

PingDB(UserConnection, String, String)

Declaration
public static bool PingDB(UserConnection userConnection, string userName, string password)
Parameters
Type Name Description
UserConnection userConnection
System.String userName
System.String password
Returns
Type Description
System.Boolean

QueryParametersToDBParameters(QueryParameterCollection, DbParameterCollection)

Declaration
protected abstract void QueryParametersToDBParameters(QueryParameterCollection queryParameters, DbParameterCollection dbParameters)
Parameters
Type Name Description
QueryParameterCollection queryParameters
System.Data.Common.DbParameterCollection dbParameters

RefreshMaterializedView(String)

Executes refresh materialized view.

Declaration
public virtual void RefreshMaterializedView(string viewName)
Parameters
Type Name Description
System.String viewName

Materialized view name.

Exceptions
Type Condition
ArgumentNullOrEmptyException

Thrown when viewName is null or empty.

System.Security.SecurityException

Thrown when viewName contains sql injections if NeedCheckAliasInQuery is set.

RefreshMaterializedView(String, Boolean)

Executes refresh materialized view.

Declaration
protected virtual void RefreshMaterializedView(string viewName, bool isConcurrently)
Parameters
Type Name Description
System.String viewName

Materialized view name.

System.Boolean isConcurrently

Add concurrently flag when execute refresh materialized view.

Exceptions
Type Condition
ArgumentNullOrEmptyException

Thrown when viewName is null or empty.

System.Security.SecurityException

Thrown when viewName contains sql injections if NeedCheckAliasInQuery is set.

RollbackTransaction()

Rolls back a transaction from a pending state.

Declaration
public virtual void RollbackTransaction()

SetTriggerDisabled(String, String)

Disables trigger for table.

Declaration
protected virtual void SetTriggerDisabled(string triggerName, string tableName)
Parameters
Type Name Description
System.String triggerName

Name of trigger to disable.

System.String tableName

Name of table to disable the trigger.

SetTriggerEnabled(String, String)

Enables trigger for table.

Declaration
protected virtual void SetTriggerEnabled(string triggerName, string tableName)
Parameters
Type Name Description
System.String triggerName

Name of trigger to enable.

System.String tableName

Name of table to enable the trigger.

SplitBatches(String)

Declaration
protected abstract IEnumerable<string> SplitBatches(string sqlText)
Parameters
Type Name Description
System.String sqlText
Returns
Type Description
System.Collections.Generic.IEnumerable<System.String>

StartTransaction()

Starts a database transaction.

Declaration
public virtual void StartTransaction()

StartTransaction(IsolationLevel)

Starts a database transaction with the specified isolation level.

Declaration
public void StartTransaction(IsolationLevel isolationLevel)
Parameters
Type Name Description
System.Data.IsolationLevel isolationLevel

The transaction isolation level.

ValidateBatches(DbCommand, String, out String)

Declaration
protected abstract bool ValidateBatches(DbCommand command, string sqlText, out string message)
Parameters
Type Name Description
System.Data.Common.DbCommand command
System.String sqlText
System.String message
Returns
Type Description
System.Boolean

ValidateBatches(String, out String)

Declaration
public virtual bool ValidateBatches(string sqlText, out string message)
Parameters
Type Name Description
System.String sqlText
System.String message
Returns
Type Description
System.Boolean

Events

OnDisposed

Declaration
public event Action OnDisposed
Event Type
Type Description
System.Action

Implements

System.IDisposable

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.SetupExecuteReader(DBExecutor, String, Object[])
SubstituteUtilities.SetupExecuteReader(DBExecutor, Func<IDataReader>, String, Object[])
SubstituteUtilities.SetupExecuteReader(DBExecutor, IDataReader, String, Object[])
SubstituteUtilities.SetupExecuteScalar<T>(DBExecutor, String, T, Object[])
SubstituteUtilities.Instead<TInstance, TValue>(TInstance, Func<TInstance, TValue>)
TestDataUtils.SetupExecuteReader(DBExecutor, Entity, String, Object[])
TestDataUtils.SetupExecuteReader(DBExecutor, IEnumerable<Entity>, String, Object[])

See Also

System.IDisposable
Back to top Generated by DocFX