public static bool Apply( this SqlTransaction transaction, string TRANSACTION_NAME, MessageString errorMsg) { bool result = false; try { transaction.Commit(); result = true; } catch (Exception ex) { errorMsg.Append(ex.ToString()); try { if (SString.IsNotNone(TRANSACTION_NAME)) { transaction.Rollback(TRANSACTION_NAME); } else { transaction.Rollback(); } } catch (Exception) { errorMsg.Append(ex.ToString()); } } return(result); }
public static bool Apply( this SqlTransaction transaction, string TRANSACTION_NAME, out string errorMsg) { errorMsg = string.Empty; bool result = false; try { transaction.Commit(); result = true; } catch (Exception ex) { errorMsg = ex.ToString(); try { if (SString.IsNotNone(TRANSACTION_NAME)) { transaction.Rollback(TRANSACTION_NAME); } else { transaction.Rollback(); } } catch (Exception) { errorMsg = $"{errorMsg}{ex.ToString()}"; } } return(result); }