public void Execute(DbTransactionCommandDelegate dbTransactionCommandDelegate)
 {
     if (dbTransactionCommandDelegate != null)
     {
         bool isOk = true;
         foreach (IDbTransactionScope scope in transactionScopeList)
         {
             try
             {
                 scope.Execute(dbTransactionCommandDelegate);
             }
             catch
             {
                 isOk = false;
                 break;
             }
         }
         Complete(isOk);
     }
 }
Пример #2
0
 public void Execute(DbTransactionCommandDelegate transactionDelegate)
 {
     ExecuteCount++;
     if (transactionDelegate != null)
     {
         try
         {
             transactionDelegate(this.dbCommand);
             //此处不能提交事务:
             //1.单个DbTransactionScope让调用者触发Complete
             //2.当被DbTransactionScopeCollections包含时由DbTransactionScopeCollections触发Complete
         }
         catch (Exception ex)
         {
             executeExceptionMsg = ex.Message;
             Complete(false);
             //抛出异常让DbTransactionScopeCollections能够捕获并及时中断可能存在的后续的其它事务
             throw ex;
         }
     }
 }