コード例 #1
0
 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();
             }
         }
     }
 }
コード例 #2
0
 public void Rollback()
 {
     if (rhinoTransaction != null)
     {
         rhinoTransaction.Rollback();
         Dispose();
     }
 }
コード例 #3
0
        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();
            }
        }