Class DataConnection
- Namespace
- CMS.DataProviderSQL
- Assembly
- CMS.DataEngine.dll
Represents SQL Server data connection.
public class DataConnection : AbstractDataConnection, IDataConnection, INotCopyThreadItem
- Inheritance
-
objectDataConnection
- Implements
- Inherited Members
- Extension Methods
Constructors
DataConnection(string)
Constructor.
protected DataConnection(string connectionString)
Parameters
connectionString
stringConnection string
Methods
BulkInsert(DataTable, string, BulkInsertSettings)
Performs a bulk insert of the data into a target database table
public override void BulkInsert(DataTable sourceData, string targetTable, BulkInsertSettings insertSettings = null)
Parameters
sourceData
DataTableSource data table
targetTable
stringName of the target DB table
insertSettings
BulkInsertSettingsBulk insert configuration
CreateCommand(string)
Creates a new SQL command
protected override DbCommand CreateCommand(string cmdText)
Parameters
cmdText
stringCommand text
Returns
- DbCommand
CreateDataAdapter()
Creates a data adapter
protected override DbDataAdapter CreateDataAdapter()
Returns
- DbDataAdapter
CreateNativeConnection()
Creates a new native connection
protected override IDbConnection CreateNativeConnection()
Returns
- IDbConnection
CreateParameter(DataParameter)
Creates a new command parameter
protected override DbParameter CreateParameter(DataParameter parameter)
Parameters
parameter
DataParameterQuery parameter
Returns
- DbParameter
HandleDbError(string, DbException)
Handles the database error. Returns false, if the error was not handled
protected override bool HandleDbError(string message, DbException ex)
Parameters
message
stringError message
ex
DbExceptionDatabase exception
Returns
- bool
ProcessOutParameters(DbParameterCollection, IEnumerable<DataParameter>)
Ensures propagation of output (or input-output or stored procedure return value) parameters after the SQL command execution to the query parameters collection.
protected override void ProcessOutParameters(DbParameterCollection commandParams, IEnumerable<DataParameter> queryParams)
Parameters
commandParams
DbParameterCollectionSQL command parameters
queryParams
IEnumerable<DataParameter>Query parameters
Remarks
Processing of output parameters is ensured for the following methods (and their async variants if exist): ExecuteQuery(string, QueryDataParameters, QueryTypeEnum, bool), ExecuteNonQuery(string, QueryDataParameters, QueryTypeEnum, bool), ExecuteScalar(string, QueryDataParameters, QueryTypeEnum, bool).
SetParameterType(DbParameter, Type)
Sets the parameter type to a destination type.
protected override void SetParameterType(DbParameter param, Type type)
Parameters
param
DbParameterParameter to set
type
TypeDesired parameter type