You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

32 lines
880 B

  1. using BPA.Kitchen.Core.Common.RequestAnalysis;
  2. using Furion.FriendlyException;
  3. using SqlSugar;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace BPA.KitChen.GroupMeal.SqlSugar
  10. {
  11. public class SupperRepository: UserAnalysis
  12. {
  13. public async Task<T> BaseAction<T>(SqlSugarClient db, Func<T> action, Func<T> defualtActoion, string msg)
  14. {
  15. try
  16. {
  17. db.BeginTran();
  18. var res = action.Invoke();
  19. db.CommitTran();
  20. return await Task.FromResult(res);
  21. }
  22. catch (Exception ex)
  23. {
  24. db.RollbackTran();
  25. //BPALog.WriteLog(msg + ":" + ex.Message, LogEnum.Error, null, ex);
  26. throw Oops.Oh(ex.Message);
  27. }
  28. }
  29. }
  30. }