Browse Source

!1209 租户数据库初始化 应用IgnoreTableAttribute特性
Merge pull request !1209 from ShuerChoi/next

zuohuaijun 1 năm trước cách đây
mục cha
commit
c98f7332ee
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  1. 3 1
      Admin.NET/Admin.NET.Core/SqlSugar/SqlSugarSetup.cs

+ 3 - 1
Admin.NET/Admin.NET.Core/SqlSugar/SqlSugarSetup.cs

@@ -383,7 +383,9 @@ public static class SqlSugarSetup
         db.DbMaintenance.CreateDatabase();
 
         // 获取所有业务表-初始化租户库表结构(排除系统表、日志表、特定库表)
-        var entityTypes = App.EffectiveTypes.Where(u => !u.IsInterface && !u.IsAbstract && u.IsClass && u.IsDefined(typeof(SugarTable), false) &&
+        var entityTypes = App.EffectiveTypes
+            .Where(u => !u.GetCustomAttributes<IgnoreTableAttribute>().Any())
+            .Where(u => !u.IsInterface && !u.IsAbstract && u.IsClass && u.IsDefined(typeof(SugarTable), false) &&
             !u.IsDefined(typeof(SysTableAttribute), false) && !u.IsDefined(typeof(LogTableAttribute), false) && !u.IsDefined(typeof(TenantAttribute), false)).ToList();
         if (!entityTypes.Any()) return;