ISimpleClient.cs 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq.Expressions;
  4. using System.Threading;
  5. using System.Threading.Tasks;
  6. namespace SqlSugar
  7. {
  8. public interface ISimpleClient<T> where T : class, new()
  9. {
  10. SimpleClient<T> CopyNew();
  11. RepositoryType CopyNew<RepositoryType>(IServiceProvider serviceProvider) where RepositoryType : ISugarRepository;
  12. RepositoryType CopyNew<RepositoryType>() where RepositoryType : ISugarRepository;
  13. SimpleClient<ChangeType> Change<ChangeType>() where ChangeType : class, new();
  14. RepositoryType ChangeRepository<RepositoryType>() where RepositoryType : ISugarRepository ;
  15. RepositoryType ChangeRepository<RepositoryType>(IServiceProvider serviceProvider) where RepositoryType : ISugarRepository;
  16. IDeleteable<T> AsDeleteable();
  17. IInsertable<T> AsInsertable(List<T> insertObjs);
  18. IInsertable<T> AsInsertable(T insertObj);
  19. IInsertable<T> AsInsertable(T[] insertObjs);
  20. ISugarQueryable<T> AsQueryable();
  21. ISqlSugarClient AsSugarClient();
  22. ITenant AsTenant();
  23. IUpdateable<T> AsUpdateable(List<T> updateObjs);
  24. IUpdateable<T> AsUpdateable(T updateObj);
  25. IUpdateable<T> AsUpdateable();
  26. IUpdateable<T> AsUpdateable(T[] updateObjs);
  27. int Count(Expression<Func<T, bool>> whereExpression);
  28. bool Delete(Expression<Func<T, bool>> whereExpression);
  29. bool Delete(T deleteObj);
  30. bool Delete(List<T> deleteObjs);
  31. bool DeleteById(dynamic id);
  32. bool DeleteByIds(dynamic[] ids);
  33. T GetById(dynamic id);
  34. List<T> GetList();
  35. List<T> GetList(Expression<Func<T, bool>> whereExpression);
  36. List<T> GetPageList(Expression<Func<T, bool>> whereExpression, PageModel page);
  37. List<T> GetPageList(Expression<Func<T, bool>> whereExpression, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc);
  38. List<T> GetPageList(List<IConditionalModel> conditionalList, PageModel page);
  39. List<T> GetPageList(List<IConditionalModel> conditionalList, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc);
  40. T GetSingle(Expression<Func<T, bool>> whereExpression);
  41. T GetFirst(Expression<Func<T, bool>> whereExpression);
  42. bool Insert(T insertObj);
  43. bool InsertOrUpdate(T data);
  44. bool InsertOrUpdate(List<T> datas);
  45. bool InsertRange(List<T> insertObjs);
  46. bool InsertRange(T[] insertObjs);
  47. int InsertReturnIdentity(T insertObj);
  48. long InsertReturnBigIdentity(T insertObj);
  49. long InsertReturnSnowflakeId(T insertObj);
  50. List<long> InsertReturnSnowflakeId(List<T> insertObjs);
  51. T InsertReturnEntity(T insertObj);
  52. bool IsAny(Expression<Func<T, bool>> whereExpression);
  53. bool Update(Expression<Func<T, T>> columns, Expression<Func<T, bool>> whereExpression);
  54. bool UpdateSetColumnsTrue(Expression<Func<T, T>> columns, Expression<Func<T, bool>> whereExpression);
  55. bool Update(T updateObj);
  56. bool UpdateRange(List<T> updateObjs);
  57. bool UpdateRange(T[] updateObjs);
  58. Task<int> CountAsync(Expression<Func<T, bool>> whereExpression);
  59. Task<bool> DeleteAsync(Expression<Func<T, bool>> whereExpression);
  60. Task<bool> DeleteAsync(T deleteObj);
  61. Task<bool> DeleteAsync(List<T> deleteObjs);
  62. Task<bool> DeleteByIdAsync(dynamic id);
  63. Task<bool> DeleteByIdsAsync(dynamic[] ids);
  64. Task<T> GetByIdAsync(dynamic id);
  65. Task<List<T>> GetListAsync();
  66. Task<List<T>> GetListAsync(Expression<Func<T, bool>> whereExpression);
  67. Task<List<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, PageModel page);
  68. Task<List<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc);
  69. Task<List<T>> GetPageListAsync(List<IConditionalModel> conditionalList, PageModel page);
  70. Task<List<T>> GetPageListAsync(List<IConditionalModel> conditionalList, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc);
  71. Task<T> GetSingleAsync(Expression<Func<T, bool>> whereExpression);
  72. Task<T> GetFirstAsync(Expression<Func<T, bool>> whereExpression);
  73. Task<bool> InsertAsync(T insertObj);
  74. Task<bool> InsertOrUpdateAsync(T data);
  75. Task<bool> InsertOrUpdateAsync(List<T> datas);
  76. Task<bool> InsertRangeAsync(List<T> insertObjs);
  77. Task<bool> InsertRangeAsync(T[] insertObjs);
  78. Task<int> InsertReturnIdentityAsync(T insertObj);
  79. Task<long> InsertReturnBigIdentityAsync(T insertObj);
  80. Task<long> InsertReturnSnowflakeIdAsync(T insertObj);
  81. Task<List<long>> InsertReturnSnowflakeIdAsync(List<T> insertObjs);
  82. Task<T> InsertReturnEntityAsync(T insertObj);
  83. Task<bool> IsAnyAsync(Expression<Func<T, bool>> whereExpression);
  84. Task<bool> UpdateSetColumnsTrueAsync(Expression<Func<T, T>> columns, Expression<Func<T, bool>> whereExpression);
  85. Task<bool> UpdateAsync(Expression<Func<T, T>> columns, Expression<Func<T, bool>> whereExpression);
  86. Task<bool> UpdateAsync(T updateObj);
  87. Task<bool> UpdateRangeAsync(List<T> updateObjs);
  88. Task<bool> UpdateRangeAsync(T[] updateObjs);
  89. Task<int> CountAsync(Expression<Func<T, bool>> whereExpression, CancellationToken cancellationToken);
  90. Task<bool> DeleteAsync(Expression<Func<T, bool>> whereExpression, CancellationToken cancellationToken);
  91. Task<bool> DeleteAsync(T deleteObj, CancellationToken cancellationToken);
  92. Task<bool> DeleteAsync(List<T> deleteObjs, CancellationToken cancellationToken);
  93. Task<bool> DeleteByIdAsync(dynamic id, CancellationToken cancellationToken);
  94. Task<bool> DeleteByIdsAsync(dynamic[] ids, CancellationToken cancellationToken);
  95. Task<T> GetByIdAsync(dynamic id, CancellationToken cancellationToken);
  96. Task<List<T>> GetListAsync( CancellationToken cancellationToken);
  97. Task<List<T>> GetListAsync(Expression<Func<T, bool>> whereExpression, CancellationToken cancellationToken);
  98. Task<List<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, PageModel page, CancellationToken cancellationToken);
  99. Task<List<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc, CancellationToken cancellationToken=default);
  100. Task<List<T>> GetPageListAsync(List<IConditionalModel> conditionalList, PageModel page, CancellationToken cancellationToken);
  101. Task<List<T>> GetPageListAsync(List<IConditionalModel> conditionalList, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc, CancellationToken cancellationToken=default);
  102. Task<T> GetSingleAsync(Expression<Func<T, bool>> whereExpression, CancellationToken cancellationToken);
  103. Task<T> GetFirstAsync(Expression<Func<T, bool>> whereExpression, CancellationToken cancellationToken);
  104. Task<bool> InsertAsync(T insertObj, CancellationToken cancellationToken);
  105. Task<bool> InsertOrUpdateAsync(T data, CancellationToken cancellationToken);
  106. Task<bool> InsertOrUpdateAsync(List<T> datas, CancellationToken cancellationToken);
  107. Task<bool> InsertRangeAsync(List<T> insertObjs, CancellationToken cancellationToken);
  108. Task<bool> InsertRangeAsync(T[] insertObjs, CancellationToken cancellationToken);
  109. Task<int> InsertReturnIdentityAsync(T insertObj, CancellationToken cancellationToken);
  110. Task<long> InsertReturnBigIdentityAsync(T insertObj, CancellationToken cancellationToken);
  111. Task<long> InsertReturnSnowflakeIdAsync(T insertObj, CancellationToken cancellationToken);
  112. Task<List<long>> InsertReturnSnowflakeIdAsync(List<T> insertObjs, CancellationToken cancellationToken);
  113. Task<T> InsertReturnEntityAsync(T insertObj, CancellationToken cancellationToken);
  114. Task<bool> IsAnyAsync(Expression<Func<T, bool>> whereExpression, CancellationToken cancellationToken);
  115. Task<bool> UpdateSetColumnsTrueAsync(Expression<Func<T, T>> columns, Expression<Func<T, bool>> whereExpression, CancellationToken cancellationToken);
  116. Task<bool> UpdateAsync(Expression<Func<T, T>> columns, Expression<Func<T, bool>> whereExpression, CancellationToken cancellationToken);
  117. Task<bool> UpdateAsync(T updateObj, CancellationToken cancellationToken);
  118. Task<bool> UpdateRangeAsync(List<T> updateObjs, CancellationToken cancellationToken);
  119. Task<bool> UpdateRangeAsync(T[] updateObjs, CancellationToken cancellationToken);
  120. }
  121. }