public static void AutoRollbackTransaction(IsolationLevel level, Proc transactional, UnitOfWorkNestingOptions nestingOptions) { using (UnitOfWork.Start(nestingOptions)) { // If we are already in a transaction, don't start a new one if (UnitOfWork.Current.IsInActiveTransaction) { transactional(); } else { RhinoTransaction tx = UnitOfWork.Current.BeginTransaction(level); try { transactional(); tx.Rollback(); } catch { tx.Rollback(); throw; } finally { tx.Dispose(); } } } }
public void Rollback() { if (rhinoTransaction != null) { rhinoTransaction.Rollback(); Dispose(); } }
public void TransactionalFlush(IsolationLevel isolationLevel) { RhinoTransaction tx = UnitOfWork.Current.BeginTransaction(isolationLevel); try { //forces a flush of the current unit of work tx.Commit(); } catch { tx.Rollback(); throw; } finally { tx.Dispose(); } }