Click or drag to resize
ConnectionHelper Class
Connection helper class.
Inheritance Hierarchy
SystemObject
  CMS.DataEngineConnectionHelper

Namespace: CMS.DataEngine
Assembly: CMS.DataEngine (in CMS.DataEngine.dll) Version: 11.0.0
Syntax
C#
public static class ConnectionHelper

The ConnectionHelper type exposes the following members.

Fields
  NameDescription
Public fieldStatic memberDEFAULT_CONNECTIONSTRING_NAME
Default connection string name
Public fieldStatic memberDefaultCommandTimeout
Command timeout for the SQL commands.
Public fieldStatic memberLongRunningCommandTimeout
Command timeout in seconds for the SQL queries which are known to possibly take more time than standard command timeout. Long running queries have to be explicitly wrapped with CMSConnectionScope with its CommandTimeout property set to this value.
Public fieldStatic memberTransactionIsolationLevel
Isolation level for SQL operations with transactions.
Top
Properties
  NameDescription
Public propertyStatic memberConnectionAvailable
Returns true if the connection is available.
Public propertyStatic memberConnectionString
Global connection string.
Public propertyStatic memberConnectionStringName
Global connection string name
Public propertyStatic memberConnectionStringPrefix
Global connection string prefix
Public propertyStatic memberIsConnectionStringInitialized
Indicates whether connection string is initialized or not.
Top
Methods
  NameDescription
Public methodStatic memberBuildConnectionString
Builds a connection string based on specified parameters.
Public methodStatic memberBulkInsert
Performs a bulk insert of the data into a target database table
Public methodStatic memberClear
Clears the connection helper cache
Public methodStatic memberExecuteNonQuery(String, QueryDataParameters, QueryMacros)
Executes the query and returns the number of rows affected.
Public methodStatic memberExecuteNonQuery(String, QueryDataParameters, QueryTypeEnum, Boolean)
Executes the query and returns the number of rows affected.
Public methodStatic memberExecuteNonQueryAsync(String, CancellationToken, QueryDataParameters, QueryMacros)

Executes the query asynchronously and returns the number of rows affected.

The cancellation token can be used to request that the operation be abandoned before the command timeout elapses. Exceptions will be reported via the returned Task object.

Public methodStatic memberExecuteNonQueryAsync(String, QueryDataParameters, QueryTypeEnum, CancellationToken, Boolean)

Executes the query asynchronously and returns the number of rows affected.

The cancellation token can be used to request that the operation be abandoned before the command timeout elapses. Exceptions will be reported via the returned Task object.

Public methodStatic memberExecuteQuery(QueryParameters)
Executes query and returns result as a dataset.
Public methodStatic memberExecuteQuery(String, QueryDataParameters, QueryTypeEnum, Boolean)
Runs the query.
Public methodStatic memberExecuteQuery(String, QueryDataParameters, String, String, Int32, String)
Executes query and returns result as a dataset.
Public methodStatic memberExecuteQuery(String, QueryDataParameters, String, String, Int32, String, Int32, Int32, Int32)
Executes query and returns result as a dataset.
Public methodStatic memberExecuteReader
Executes the query and returns result of the query as a DbDataReader.
Public methodStatic memberExecuteReaderAsync

Executes the query asynchronously and returns result as a DbDataReader.

The cancellation token can be used to request that the operation be abandoned before the command timeout elapses. Exceptions will be reported via the returned Task object.

Public methodStatic memberExecuteScalar(String, QueryDataParameters, QueryMacros)
Executes the query and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.
Public methodStatic memberExecuteScalar(String, QueryDataParameters, QueryTypeEnum, Boolean)
Executes the query and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.
Public methodStatic memberExecuteScalarAsync(String, CancellationToken, QueryDataParameters, QueryMacros)

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

The cancellation token can be used to request that the operation be abandoned before the command timeout elapses. Exceptions will be reported via the returned Task object.

Public methodStatic memberExecuteScalarAsync(String, QueryDataParameters, QueryTypeEnum, CancellationToken, Boolean)

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

The cancellation token can be used to request that the operation be abandoned before the command timeout elapses. Exceptions will be reported via the returned Task object.

Public methodStatic memberGetConnection
Returns the connection.
Public methodStatic memberGetConnectionByName
Returns the connection.
Public methodStatic memberGetConnectionString(String)
Gets the connection string of provided connectionStringName.
Public methodStatic memberGetConnectionString(String, Boolean)
Gets the connection string of provided connectionStringName.
Public methodStatic memberGetConnectionStringPrefix
Gets the connection string name for the given domain
Public methodStatic memberGetFirstFoundConnectionString
Gets the first found connection string by the prefix, if none found, returns null
Public methodStatic memberGetIsolationLevel
Returns the isolation level evaluated from the string representation.
Public methodStatic memberGetSqlConnectionString
Returns the connection string.
Public methodStatic memberGetSqlConnectionString(String)
Returns the connection string.
Public methodStatic memberInitRequestContext
Initializes the request context to use proper database based on current domain name
Public methodStatic memberTestConnection(String)
Tests the given connection parameters.
Public methodStatic memberTestConnection(SQLServerAuthenticationModeEnum, String, String, String, String)
Tests the given connection parameters.
Top
See Also