public void UseTran(Action <SqlSugarClient> fun) { try { Ado.BeginTran(); fun(this); Ado.CommitTran(); } catch (Exception ex) { Ado.RollbackTran(); throw new FatalException(ex.Message); } }
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); } }