😎修复存在三方库链接时初始化表错误

This commit is contained in:
zuohuaijun 2025-08-07 11:15:57 +08:00
parent ecb74741c3
commit 4c46fb9139
2 changed files with 13 additions and 9 deletions

View File

@ -49,8 +49,10 @@
// "ConnectionString": "DataSource=./Admin.NET.Log.db", //
// "DbSettings": {
// "EnableInitDb": true, //
// "EnableInitView": false, //
// "EnableDiffLog": false, //
// "EnableUnderLine": false // 线
// "EnableUnderLine": false, // 线
// "EnableConnEncrypt": false // SM2
// },
// "TableSettings": {
// "EnableInitTable": true, //
@ -67,16 +69,18 @@
// "DbType": "Sqlite", //
// "ConnectionString": "DataSource=./Admin.NET.Test.db", //
// "DbSettings": {
// "EnableInitDb": true, //
// "EnableInitDb": false, //
// "EnableInitView": false, //
// "EnableDiffLog": false, //
// "EnableUnderLine": false // 线
// "EnableUnderLine": false, // 线
// "EnableConnEncrypt": false // SM2
// },
// "TableSettings": {
// "EnableInitTable": true, //
// "EnableInitTable": false, //
// "EnableIncreTable": false // [IncreTable]
// },
// "SeedSettings": {
// "EnableInitSeed": true, //
// "EnableInitSeed": false, //
// "EnableIncreSeed": false // [IncreSeed]
// }
//}

View File

@ -386,7 +386,7 @@ public static class SqlSugarExtension
(entityType.GetCustomAttribute<LogTableAttribute>() != null ||
entityType.GetCustomAttribute<TenantAttribute>() != null))
{
Console.WriteLine($" 忽略 {seedType.FullName,-58} ({dbProvider.CurrentConnectionConfig.ConfigId}) 原因:非SysTable 与 (LogTable 或 Tenant)");
Console.WriteLine($" 忽略 {seedType.FullName,-58} ({dbProvider.CurrentConnectionConfig.ConfigId}) 原因: 非SysTable 与 (LogTable 或 Tenant)");
return default;
}
}
@ -394,7 +394,7 @@ public static class SqlSugarExtension
{
if (entityType.GetCustomAttribute<LogTableAttribute>() == null)
{
Console.WriteLine($" 忽略 {seedType.FullName,-58} ({dbProvider.CurrentConnectionConfig.ConfigId}) 原因:LogTable");
Console.WriteLine($" 忽略 {seedType.FullName,-58} ({dbProvider.CurrentConnectionConfig.ConfigId}) 原因:LogTable");
return default;
}
}
@ -403,7 +403,7 @@ public static class SqlSugarExtension
var att = entityType.GetCustomAttribute<TenantAttribute>(); // 自定义的库
if (att == null || att.configId.ToString() != config.ConfigId.ToString())
{
Console.WriteLine($" 忽略 {seedType.FullName,-58} ({dbProvider.CurrentConnectionConfig.ConfigId}) 原因: Tenant ,但不是这个库:{att.configId} != {config.ConfigId} ");
Console.WriteLine($" 忽略 {seedType.FullName,-58} ({dbProvider.CurrentConnectionConfig.ConfigId}) 原因: Tenant表");
return default;
}
}
@ -413,7 +413,7 @@ public static class SqlSugarExtension
var seedData = ((IEnumerable)hasDataMethod?.Invoke(instance, null))?.Cast<object>().ToArray() ?? [];
if (seedData.Length == 0)
{
Console.WriteLine($" 忽略 {seedType.FullName,-58} ({dbProvider.CurrentConnectionConfig.ConfigId}) 原因:没有数据");
Console.WriteLine($" 忽略 {seedType.FullName,-58} ({dbProvider.CurrentConnectionConfig.ConfigId}) 原因: 没有种子数据");
return default;
}