SqlSugarRepository.cs 463 B

12345678910111213141516
  1. namespace Admin.NET.Core;
  2. /// <summary>
  3. /// SqlSugar仓储类
  4. /// </summary>
  5. /// <typeparam name="T"></typeparam>
  6. public class SqlSugarRepository<T> : SimpleClient<T> where T : class, new()
  7. {
  8. protected ITenant iTenant = null; // 多租户事务
  9. public SqlSugarRepository(ISqlSugarClient context = null) : base(context)
  10. {
  11. iTenant = App.GetService<ISqlSugarClient>().AsTenant();
  12. Context = iTenant.GetConnectionWithAttr<T>();
  13. }
  14. }