Browse Source

😁优化SqlSugar仓储基类

zuohuaijun 2 years ago
parent
commit
cf7fb837e1
1 changed files with 2 additions and 3 deletions
  1. 2 3
      Admin.NET/Admin.NET.Core/SqlSugar/SqlSugarRepository.cs

+ 2 - 3
Admin.NET/Admin.NET.Core/SqlSugar/SqlSugarRepository.cs

@@ -24,9 +24,8 @@ public class SqlSugarRepository<T> : SimpleClient<T> where T : class, new()
         // 若实体贴有日志表特性,则返回日志库连接
         if (typeof(T).IsDefined(typeof(LogTableAttribute), false))
         {
-            var sqlSugarScopeProviderLog = iTenant.GetConnectionScope(SqlSugarConst.LogConfigId);
-            if (sqlSugarScopeProviderLog != null)
-                base.Context = sqlSugarScopeProviderLog;
+            if (iTenant.IsAnyConnection(SqlSugarConst.LogConfigId))
+                base.Context = iTenant.GetConnectionScope(SqlSugarConst.LogConfigId);
             return;
         }