public static void Transaction(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.Commit(); } catch { tx.Rollback(); throw; } finally { tx.Dispose(); } } } }
protected void Dispose() { try { rhinoTransaction.Dispose(); } finally { if (unitOfWork != null) { unitOfWork.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(); } }