Ejemplo n.º 1
0
        public static void WrapTrans(this SqlConnection conn, System.Data.IsolationLevel iso, TransactionBody fnBody)
        {
            int cMaxTry = 5;

            while (cMaxTry > 0)
            {
                cMaxTry--;
                using (var trans = conn.BeginTransaction(iso)) {
                    try {
                        fnBody(trans);
                        trans.Commit();
                        return;
                    } catch (Exception e) {
                        try {
                            trans.Rollback();
                            HandleTransError(e);
                        } catch (Exception re) {
                            throw new Exception(re.Message, e);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
 public void Post([FromBody] TransactionBody value)
 {
     _transactionService.AddTransaction(value);
 }
Ejemplo n.º 3
0
 public static void WrapTrans(this SqlConnection conn, TransactionBody fnBody)
 {
     WrapTrans(conn, System.Data.IsolationLevel.ReadCommitted, fnBody);
 }