Class ConnectionManager
- Namespace
- SWConfigDataClientLib.DataManager
- Assembly
- IpPbxCDSClientLib.dll
ConenctionManager encapsulates the class SQLConnection for use in datamanager classes. Handling with connection status, connection strings, transactions, itmeouts etc. is realized in a convenient way.
public class ConnectionManager : ConnectionManagerBase
- Inheritance
-
ConnectionManager
- Inherited Members
Constructors
ConnectionManager(ref SqlConnection)
Constructor
public ConnectionManager(ref SqlConnection connection)
Parameters
connection
SqlConnectionThe SqlConnection. The connection string will be replaced by the one delivered from DBConfig class
ConnectionManager(ref SqlConnection, ConnectionType)
Constructor
public ConnectionManager(ref SqlConnection connection, SDBConnection.ConnectionType type)
Parameters
connection
SqlConnectionThe SqlConnection. The connection string will be replaced by the one delivered from DBConfig class
type
SDBConnection.ConnectionType
ConnectionManager(ref SqlConnection, string)
Constructor
public ConnectionManager(ref SqlConnection connection, string connectionString)
Parameters
connection
SqlConnectionThe SqlConnection. The connection string will be replaced with the Parameter connectionString
connectionString
stringThe new connection string
Properties
Connection
Read only member representing the SQLConnection
public SqlConnection Connection { get; }
Property Value
Transaction
Read only member representing the current Trannsaction
public SqlTransaction Transaction { get; }
Property Value
Methods
GetChildRows(DataRow, DataTable)
public static DataRow[] GetChildRows(DataRow row, DataTable SubTable)
Parameters
Returns
- DataRow[]
TestConnection(out string, out bool, ConnectionType)
public static bool TestConnection(out string message, out bool TimeOutOccured, SDBConnection.ConnectionType type)
Parameters
Returns
beginTransaction()
Opens a new transaction.
public void beginTransaction()
beginTransaction(string, IsolationLevel)
Opens a new transaction.
public void beginTransaction(string name, IsolationLevel level)
Parameters
name
stringlevel
IsolationLevel
close()
Closes the connection.
public override void close()
commitTransaction()
Commits the transaction and removes it from all assoiated SqlCommands.
public void commitTransaction()
open()
Opens the connection.
public override void open()
Remarks
Does nothing if connection is already opened
registerOuterTransactionConnection(ConnectionManager)
Sets an external outer ConnectionManager wich can be used for Transactions in which more than one Datamanager is involved.
public void registerOuterTransactionConnection(ConnectionManager externManager)
Parameters
externManager
ConnectionManager
registerTransactionConnection(SqlCommand)
Sets the transaction member of the SqlCommand to the current transaction.
public void registerTransactionConnection(SqlCommand cmd)
Parameters
cmd
SqlCommand
Remarks
Uses the outer ConnectionMananger is set.
registerTransactionConnection(SqlDataAdapter)
Sets the transaction member to all SqlCommands of the SqlAdapter to the current transaction.
public void registerTransactionConnection(SqlDataAdapter da)
Parameters
Remarks
Uses the outer ConnectionMananger is set.
removeOuterTranactionConnection()
Removes external outer ConnectionManager wich can be used for Transactions in which more than one Datamanager is involved.
public void removeOuterTranactionConnection()
rollbackTransaction()
Rollback the transaction and removes it from all assoiated SqlCommands.
public void rollbackTransaction()
rollbackTransaction(string)
Rollback the transaction and removes it from all assoiated SqlCommands.
public void rollbackTransaction(string name)
Parameters
name
string
setCommandTimeout(SqlCommand, int)
Sets the timeout of the command.
public void setCommandTimeout(SqlCommand cmd, int v)
Parameters
cmd
SqlCommandv
int
setCommandTimeout(SqlDataAdapter, int)
Sets the timeout an all commands of the SqlDataAdapter.
public void setCommandTimeout(SqlDataAdapter da, int v)
Parameters
da
SqlDataAdapterv
int
setIsolationLevel(IsolationLevel)
Opens a new transaction.
public void setIsolationLevel(IsolationLevel level)
Parameters
level
IsolationLevel
setTransactionTimeout(int)
Sets the timeout an all commands which is assosiated wiht the current transaction.
public void setTransactionTimeout(int v)
Parameters
v
int