Merge pull request '😁perf: 代码优化' (#357) from jasondom/Admin.NET.Pro:v2 into v2
Reviewed-on: https://code.adminnet.top/Admin.NET/Admin.NET.Pro/pulls/357
This commit is contained in:
commit
144792d0b5
@ -400,7 +400,7 @@ public static class SqlSugarSetup
|
||||
entityTypes = entityTypes.Where(u => u.GetCustomAttribute<TenantAttribute>()?.configId.ToString() == config.ConfigId.ToString()).ToList(); // 自定义的库
|
||||
|
||||
// 过滤指定实体
|
||||
if (entityNames != null && entityNames.Count > 0)
|
||||
if (entityNames is { Count: > 0 })
|
||||
entityTypes = entityTypes.Where(u => entityNames.Contains(u.Name)).ToList();
|
||||
|
||||
// 删除视图再初始化表结构,防止因为视图导致无法同步表结构
|
||||
@ -441,8 +441,8 @@ public static class SqlSugarSetup
|
||||
// 扫描所有继承 AppStartup 的类(排序执行顺序)
|
||||
var startups = App.EffectiveTypes
|
||||
.Where(u => typeof(AppStartup).IsAssignableFrom(u) && u.IsClass && !u.IsAbstract && !u.IsGenericType && (u.GetMethod("BeforeInitTable") != null || u.GetMethod("AfterInitSeed") != null))
|
||||
.OrderByDescending(u => !u.IsDefined(typeof(AppStartupAttribute), true) ? 0 : u.GetCustomAttribute<AppStartupAttribute>(true).Order);
|
||||
if (startups == null || !startups.Any()) return (startups, 0, 0);
|
||||
.OrderByDescending(u => !u.IsDefined(typeof(AppStartupAttribute), true) ? 0 : u.GetCustomAttribute<AppStartupAttribute>(true)!.Order);
|
||||
if (!startups!.Any()) return (startups, 0, 0);
|
||||
|
||||
long oldVerion = 0, currentVersion = 0;
|
||||
try
|
||||
|
||||
Loading…
Reference in New Issue
Block a user