Transactions Management

The Engine.IgnoreExceptions property provides a new approach to transactions management in V2. In V1 the Engine.Run method never raised any exceptions writing all exceptions to the logfile. Now you can set the IgnoreExceptions property to false and if any exception occurs in your interfaces implementation the Run method will throw an exception.

Often during a single call to Run method, several method implementations are called by the Engine each updating your repository. To execute all methods in a single transaction, you will usually set IgnoreExceptions property to false and start a transaction before calling Run method (or during the first update). If any update fails you will rollback the transaction in catch block:

engine.IgnoreExceptions = false;
try
{
    BeginTransaction();
    engine.Run(request, response);
    CommitTransaction();
}
catch
{
    RollBackTransaction();
}
finally
{
    CloseConnection();
}

Note that you do not need to log the exception in your catch block. The exception is logged by the Engine in Run method.