readonly bool noTranByDefault = false; var isBorrowedTransaction = ConnectionScope.Current.HasTransaction; var tran = ConnectionScope.ValidateOrCreateTransaction(); if (!tran.IsOpen) { tran = ConnectionScope.CreateTransaction(); isBorrowedTransaction = false; } try { //业务 if (!isBorrowedTransaction && tran.IsOpen) tran.Commit(); } catch (Exception ex) { if (!isBorrowedTransaction && tran.IsOpen) tran.Rollback(); if (ExceptionPolicy.HandleException(ex, "BusinessOperationExceptionPolicy")) throw; } finally { if (!isBorrowedTransaction) tran.Dispose(); }