Пример #1
0
 public void UseTran(Action <SqlSugarClient> fun)
 {
     try
     {
         Ado.BeginTran();
         fun(this);
         Ado.CommitTran();
     }
     catch (Exception ex)
     {
         Ado.RollbackTran();
         throw new FatalException(ex.Message);
     }
 }
Пример #2
0
 public T UseTran <T>(Func <SqlSugarClient, T> fun)
 {
     try
     {
         Ado.BeginTran();
         var t = fun(this);
         Ado.CommitTran();
         return(t);
     }
     catch (Exception ex)
     {
         Ado.RollbackTran();
         throw new FatalException(ex.Message);
     }
 }