SqlSguarTransaction.cs 661 B

12345678910111213141516171819202122232425262728293031
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace SqlSugar
  7. {
  8. public class SqlSugarTransaction:IDisposable
  9. {
  10. private readonly SqlSugarClient context;
  11. public SqlSugarTransaction(SqlSugarClient client)
  12. {
  13. context = client;
  14. context.BeginTran();
  15. }
  16. public void CommitTran()
  17. {
  18. context.CommitTran();
  19. }
  20. public void RollbackTran()
  21. {
  22. context.RollbackTran();
  23. }
  24. public void Dispose()
  25. {
  26. context.RollbackTran();
  27. }
  28. }
  29. }