OpenPetra
Free Administration Software for Non-Profits
Ict.Common.DB.TDBTransaction Class Reference

A generic Class for managing all kinds of ADO.NET Database Transactions - to be used instead of concrete ADO.NET Transaction objects, eg. OdbcTransaction or NpgsqlTransaction, etc. Effectively wraps ADO.NET Transaction objects. More...

Inheritance diagram for Ict.Common.DB.TDBTransaction:

Public Member Functions

 TDBTransaction ()
 
 TDBTransaction (TDataBase ADataBase, IsolationLevel AIsolationLevel, string ATransactionName="")
 Constructor for a TDBTransaction Object. More...
 
void BeginTransaction (TDataBase ADataBase, IsolationLevel AIsolationLevel, string ATransactionName="")
 to begin a transaction on an existing TDBTransaction object. More...
 
void CopyFrom (TDBTransaction AOther)
 copy all data from existing transaction More...
 
string GetDBTransactionIdentifier ()
 Returns a string containing the TransactionIdentifier. If a TransactionName was assigned when the DB Transaction was created it is included, too. Gets logged and hence can aid debugging (also useful for Unit Testing). More...
 
void Commit ()
 commit the transaction More...
 
void Rollback ()
 roll back the transaction More...
 
void Dispose ()
 Releases all resources used by the TDBTransaction (these are really only resources held by the WrappedTransaction and Connection). More...
 

Protected Member Functions

virtual void Dispose (bool ADisposing)
 Releases the unmanaged resources used by the TDBTransaction (these are really only resources held by the WrappedTransaction and optionally releases the managed resources of that object. More...
 

Properties

System.Guid TransactionIdentifier [get]
 An identifier ('Globally Unique Identifier (GUID)') that uniquely identifies a DB Transaction once it got created. It is used for internal 'sanity checks'. It also gets logged and hence can aid debugging (also useful for Unit Testing). More...
 
TDataBase DataBaseObj [get]
 Instance of TDataBase that this Transaction belongs to. More...
 
string TransactionName [get]
 Name of the DB Transaction (optional). It gets logged and hence can aid debugging (also useful for Unit Testing). More...
 
System.Guid ConnectionIdentifier [get]
 An identifier ('Globally Unique Identifier (GUID)') that uniquely identifies the DB Connection that this DB Transaction is running against. It is used for internal 'sanity checks'. It also gets logged and hence can aid debugging (also useful for Unit Testing). More...
 
DbConnection Connection [get]
 Database connection to which the Transaction belongs. More...
 
System.Data.IsolationLevel IsolationLevel [get]
 IsolationLevel of the Transaction. More...
 
DbTransaction WrappedTransaction [get]
 DbTransaction that is wrapped in an instance of this class, i.e. which the instance of this class represents. More...
 
bool Valid [get]
 True if the Transaction hasn't been Committed or Rolled Back, otherwise false. More...
 
string AppDomainNameThatTransactionWasStartedIn [get]
 Name of the AppDomain that the DB Transaction was started in. It gets logged and hence can aid debugging (also useful for Unit Testing). More...
 

Detailed Description

A generic Class for managing all kinds of ADO.NET Database Transactions - to be used instead of concrete ADO.NET Transaction objects, eg. OdbcTransaction or NpgsqlTransaction, etc. Effectively wraps ADO.NET Transaction objects.

Constructor & Destructor Documentation

◆ TDBTransaction() [1/2]

Ict.Common.DB.TDBTransaction.TDBTransaction ( )
inline

constructor for empty transaction. it can be filled with calling BeginTransaction.

◆ TDBTransaction() [2/2]

Ict.Common.DB.TDBTransaction.TDBTransaction ( TDataBase  ADataBase,
IsolationLevel  AIsolationLevel,
string  ATransactionName = "" 
)
inline

Constructor for a TDBTransaction Object.

Parameters
ADataBaseThe database connection that this transaction should be created from.
AIsolationLevelThe isolation level
ATransactionNameName of the DB Transaction (optional). It gets logged and hence can aid debugging (also useful for Unit Testing).

Member Function Documentation

◆ BeginTransaction()

void Ict.Common.DB.TDBTransaction.BeginTransaction ( TDataBase  ADataBase,
IsolationLevel  AIsolationLevel,
string  ATransactionName = "" 
)
inline

to begin a transaction on an existing TDBTransaction object.

◆ Commit()

void Ict.Common.DB.TDBTransaction.Commit ( )
inline

commit the transaction

◆ CopyFrom()

void Ict.Common.DB.TDBTransaction.CopyFrom ( TDBTransaction  AOther)
inline

copy all data from existing transaction

◆ Dispose() [1/2]

void Ict.Common.DB.TDBTransaction.Dispose ( )
inline

Releases all resources used by the TDBTransaction (these are really only resources held by the WrappedTransaction and Connection).

◆ Dispose() [2/2]

virtual void Ict.Common.DB.TDBTransaction.Dispose ( bool  ADisposing)
inlineprotectedvirtual

Releases the unmanaged resources used by the TDBTransaction (these are really only resources held by the WrappedTransaction and optionally releases the managed resources of that object.

Parameters
ADisposingTrue to release both managed and unmanaged resources; false to release only unmanaged resources.

◆ GetDBTransactionIdentifier()

string Ict.Common.DB.TDBTransaction.GetDBTransactionIdentifier ( )
inline

Returns a string containing the TransactionIdentifier. If a TransactionName was assigned when the DB Transaction was created it is included, too. Gets logged and hence can aid debugging (also useful for Unit Testing).

Returns
String containing the TransactionIdentifier. If a TransactionName was assigned when the DB Transaction was created it is included, too.

◆ Rollback()

void Ict.Common.DB.TDBTransaction.Rollback ( )
inline

roll back the transaction

Property Documentation

◆ AppDomainNameThatTransactionWasStartedIn

string Ict.Common.DB.TDBTransaction.AppDomainNameThatTransactionWasStartedIn
get

Name of the AppDomain that the DB Transaction was started in. It gets logged and hence can aid debugging (also useful for Unit Testing).

◆ Connection

DbConnection Ict.Common.DB.TDBTransaction.Connection
get

Database connection to which the Transaction belongs.

◆ ConnectionIdentifier

System.Guid Ict.Common.DB.TDBTransaction.ConnectionIdentifier
get

An identifier ('Globally Unique Identifier (GUID)') that uniquely identifies the DB Connection that this DB Transaction is running against. It is used for internal 'sanity checks'. It also gets logged and hence can aid debugging (also useful for Unit Testing).

◆ DataBaseObj

TDataBase Ict.Common.DB.TDBTransaction.DataBaseObj
get

Instance of TDataBase that this Transaction belongs to.

Can be used e.g. in Static Methods to get the TDataBase instance that a TDBTransaction object was instantiated on. This TDataBase instance can then be used to execute calls on the proper TDataBase instance without needing to have this instance readily in a given context (thinking of static Methods in the 'Typed DataStore' here)!

◆ IsolationLevel

System.Data.IsolationLevel Ict.Common.DB.TDBTransaction.IsolationLevel
get

IsolationLevel of the Transaction.

◆ TransactionIdentifier

System.Guid Ict.Common.DB.TDBTransaction.TransactionIdentifier
get

An identifier ('Globally Unique Identifier (GUID)') that uniquely identifies a DB Transaction once it got created. It is used for internal 'sanity checks'. It also gets logged and hence can aid debugging (also useful for Unit Testing).

◆ TransactionName

string Ict.Common.DB.TDBTransaction.TransactionName
get

Name of the DB Transaction (optional). It gets logged and hence can aid debugging (also useful for Unit Testing).

◆ Valid

bool Ict.Common.DB.TDBTransaction.Valid
get

True if the Transaction hasn't been Committed or Rolled Back, otherwise false.

◆ WrappedTransaction

DbTransaction Ict.Common.DB.TDBTransaction.WrappedTransaction
get

DbTransaction that is wrapped in an instance of this class, i.e. which the instance of this class represents.

WARNING: Do not do anything with this Object other than inspecting it; the correct working of Transactions in the TDataBase Object relies on the fact that TDataBase manages everything about Transactions!!!


The documentation for this class was generated from the following file: