ITenant.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace SqlSugar
  8. {
  9. public interface ITenant
  10. {
  11. void BeginTran();
  12. void BeginTran(IsolationLevel iso);
  13. void CommitTran();
  14. void RollbackTran();
  15. Task BeginTranAsync();
  16. Task BeginTranAsync(IsolationLevel iso);
  17. Task CommitTranAsync();
  18. Task RollbackTranAsync();
  19. void ChangeDatabase(object configId);
  20. void ChangeDatabase(Func<ConnectionConfig, bool> changeExpression);
  21. SqlSugarTransaction UseTran();
  22. DbResult<bool> UseTran(Action action, Action<Exception> errorCallBack = null);
  23. Task<DbResult<bool>> UseTranAsync(Func<Task> action, Action<Exception> errorCallBack = null);
  24. DbResult<T> UseTran<T>(Func<T> action, Action<Exception> errorCallBack = null);
  25. Task<DbResult<T>> UseTranAsync<T>(Func<Task<T>> action, Action<Exception> errorCallBack = null);
  26. void AddConnection(ConnectionConfig connection);
  27. SqlSugarProvider GetConnection(object configId);
  28. void RemoveConnection(object configId);
  29. SqlSugarScopeProvider GetConnectionScope(object configId);
  30. SqlSugarProvider GetConnectionWithAttr<T>();
  31. SqlSugarScopeProvider GetConnectionScopeWithAttr<T>();
  32. ISugarQueryable<T> QueryableWithAttr<T>();
  33. IInsertable<T> InsertableWithAttr<T>(T insertObj) where T : class, new();
  34. IInsertable<T> InsertableWithAttr<T>(List<T> insertObjs) where T : class, new();
  35. IUpdateable<T> UpdateableWithAttr<T>(T updateObj) where T : class, new();
  36. IUpdateable<T> UpdateableWithAttr<T>() where T : class, new();
  37. IUpdateable<T> UpdateableWithAttr<T>(List<T> updateObjs) where T : class, new();
  38. IDeleteable<T> DeleteableWithAttr<T>(T deleteObjs) where T : class, new();
  39. IDeleteable<T> DeleteableWithAttr<T>(List<T> deleteObjs) where T : class, new();
  40. IDeleteable<T> DeleteableWithAttr<T>() where T : class, new();
  41. bool IsAnyConnection(object configId);
  42. void Close();
  43. void Open();
  44. }
  45. }