C# Class Habanero.BO.DataAccessorThreadSplitter

This Data accessor manages separate sub-data accessors per thread. This is needed because in some cases the ADO.NET provider is not thread-safe (eg SQL CE) so maintaining a separate database connection per thread is required. To use it make sure that each thread in your system has added its own dataaccessor using AddDataAccessorForThread
Inheritance: IDataAccessor
ファイルを表示 Open project: Chillisoft/habanero Class Usage Examples

Public Methods

Method Description
AddDataAccessorForThread ( IDataAccessor dataAccessor ) : void

Adds a data accessor to the collection of data accessors. This data accessor will be used for this thread.

ClearDeadThreads ( ) : void

Clears data accessors for threads that have died. This method is called every 5 seconds, or can be called explicitly.

CreateTransactionCommitter ( ) : ITransactionCommitter

Creates a TransactionCommitter for you to use to persist BusinessObjects. A new TransactionCommitter is required each time an object or set of objects is persisted.

DataAccessorThreadSplitter ( IDataAccessor dataAccessor ) : System.Collections.Generic

Construct using an initial IDataAccessor, which will be the one used for this thread.

GetDataAccessorForThread ( Thread thread ) : IDataAccessor

Returns the data accessor for the given thread. You can use this to check if your current thread has a data accessor before trying to use it.

Method Details

AddDataAccessorForThread() public method

Adds a data accessor to the collection of data accessors. This data accessor will be used for this thread.
public AddDataAccessorForThread ( IDataAccessor dataAccessor ) : void
dataAccessor IDataAccessor
return void

ClearDeadThreads() public method

Clears data accessors for threads that have died. This method is called every 5 seconds, or can be called explicitly.
public ClearDeadThreads ( ) : void
return void

CreateTransactionCommitter() public method

Creates a TransactionCommitter for you to use to persist BusinessObjects. A new TransactionCommitter is required each time an object or set of objects is persisted.
public CreateTransactionCommitter ( ) : ITransactionCommitter
return ITransactionCommitter

DataAccessorThreadSplitter() public method

Construct using an initial IDataAccessor, which will be the one used for this thread.
public DataAccessorThreadSplitter ( IDataAccessor dataAccessor ) : System.Collections.Generic
dataAccessor IDataAccessor
return System.Collections.Generic

GetDataAccessorForThread() public method

Returns the data accessor for the given thread. You can use this to check if your current thread has a data accessor before trying to use it.
If no data accessor for this thread is found this exception will be thrown.
public GetDataAccessorForThread ( Thread thread ) : IDataAccessor
thread System.Threading.Thread
return IDataAccessor