C# Class uShip.NHibernate.UnitOfWork.UnitOfWorkEvents

Register global callbacks that are notified when exceptions occur during UnitOfWork calls to InnerExecute(), Transaction.Commit(), and Transaction.Rollback(). These handlers will be called for the remainder of the application lifetime, and cannot be un-registered.
Datei anzeigen Open project: uShip/NHibernateUnitOfWork

Public Methods

Method Description
AddGlobalExecuteOrCommitExceptionHandler ( OnException handler ) : void

Register a global callback that will be notified when exceptions occur during UnitOfWork calls to InnerExecute() or ITransaction.Commit(). This handler will be called for the remainder of the application lifetime, and cannot be un-registered.

AddGlobalRollbackExceptionHandler ( OnException handler ) : void

Register a global callback that will be notified when exceptions occur during UnitOfWork calls to ITransaction.Rollback(). This handler will be called for the remainder of the application lifetime, and cannot be un-registered.

The exception will still bubble up from the original call, so this is NOT a substitute for normal exception handling.

Private Methods

Method Description
OnExecuteOrCommitException ( ISessionFactory sessionFactory, Exception exc ) : void

This method should only be invoked by UnitOfWork(of T).Execute(). It is called when an exception occurs either during the InnerExecute() method or during an automatic Transaction.Commit().

OnRollbackException ( ISessionFactory sessionFactory, Exception exc ) : void

This method should only be invoked by UnitOfWork(of T).Execute(). It is called when an exception occurs during an automatic call Transaction.Rollback().

RemoveAllHandlers ( ) : void

FOR UNIT TESTING ONLY

Method Details

AddGlobalExecuteOrCommitExceptionHandler() public static method

Register a global callback that will be notified when exceptions occur during UnitOfWork calls to InnerExecute() or ITransaction.Commit(). This handler will be called for the remainder of the application lifetime, and cannot be un-registered.
public static AddGlobalExecuteOrCommitExceptionHandler ( OnException handler ) : void
handler OnException
return void

AddGlobalRollbackExceptionHandler() public static method

Register a global callback that will be notified when exceptions occur during UnitOfWork calls to ITransaction.Rollback(). This handler will be called for the remainder of the application lifetime, and cannot be un-registered.

The exception will still bubble up from the original call, so this is NOT a substitute for normal exception handling.

public static AddGlobalRollbackExceptionHandler ( OnException handler ) : void
handler OnException
return void