😎修复存在三方库链接时初始化表错误
This commit is contained in:
parent
ecb74741c3
commit
4c46fb9139
@ -49,8 +49,10 @@
|
|||||||
// "ConnectionString": "DataSource=./Admin.NET.Log.db", // 库连接字符串
|
// "ConnectionString": "DataSource=./Admin.NET.Log.db", // 库连接字符串
|
||||||
// "DbSettings": {
|
// "DbSettings": {
|
||||||
// "EnableInitDb": true, // 启用库初始化(若实体没有变化建议关闭)
|
// "EnableInitDb": true, // 启用库初始化(若实体没有变化建议关闭)
|
||||||
|
// "EnableInitView": false, // 启用视图初始化(若实体和视图没有变化建议关闭)
|
||||||
// "EnableDiffLog": false, // 启用库表差异日志
|
// "EnableDiffLog": false, // 启用库表差异日志
|
||||||
// "EnableUnderLine": false // 启用驼峰转下划线
|
// "EnableUnderLine": false, // 启用驼峰转下划线
|
||||||
|
// "EnableConnEncrypt": false // 启用数据库连接串加密(国密SM2加解密)
|
||||||
// },
|
// },
|
||||||
// "TableSettings": {
|
// "TableSettings": {
|
||||||
// "EnableInitTable": true, // 启用表初始化(若实体没有变化建议关闭)
|
// "EnableInitTable": true, // 启用表初始化(若实体没有变化建议关闭)
|
||||||
@ -67,16 +69,18 @@
|
|||||||
// "DbType": "Sqlite", // 库类型
|
// "DbType": "Sqlite", // 库类型
|
||||||
// "ConnectionString": "DataSource=./Admin.NET.Test.db", // 库连接字符串
|
// "ConnectionString": "DataSource=./Admin.NET.Test.db", // 库连接字符串
|
||||||
// "DbSettings": {
|
// "DbSettings": {
|
||||||
// "EnableInitDb": true, // 启用库初始化(若实体没有变化建议关闭)
|
// "EnableInitDb": false, // 启用库初始化(若实体没有变化建议关闭)
|
||||||
|
// "EnableInitView": false, // 启用视图初始化(若实体和视图没有变化建议关闭)
|
||||||
// "EnableDiffLog": false, // 启用库表差异日志
|
// "EnableDiffLog": false, // 启用库表差异日志
|
||||||
// "EnableUnderLine": false // 启用驼峰转下划线
|
// "EnableUnderLine": false, // 启用驼峰转下划线
|
||||||
|
// "EnableConnEncrypt": false // 启用数据库连接串加密(国密SM2加解密)
|
||||||
// },
|
// },
|
||||||
// "TableSettings": {
|
// "TableSettings": {
|
||||||
// "EnableInitTable": true, // 启用表初始化(若实体没有变化建议关闭)
|
// "EnableInitTable": false, // 启用表初始化(若实体没有变化建议关闭)
|
||||||
// "EnableIncreTable": false // 启用表增量更新(只更新贴了特性[IncreTable]的实体表)
|
// "EnableIncreTable": false // 启用表增量更新(只更新贴了特性[IncreTable]的实体表)
|
||||||
// },
|
// },
|
||||||
// "SeedSettings": {
|
// "SeedSettings": {
|
||||||
// "EnableInitSeed": true, // 启用种子初始化(若种子没有变化建议关闭)
|
// "EnableInitSeed": false, // 启用种子初始化(若种子没有变化建议关闭)
|
||||||
// "EnableIncreSeed": false // 启用种子增量更新(只更新贴了特性[IncreSeed]的种子表)
|
// "EnableIncreSeed": false // 启用种子增量更新(只更新贴了特性[IncreSeed]的种子表)
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
|||||||
@ -386,7 +386,7 @@ public static class SqlSugarExtension
|
|||||||
(entityType.GetCustomAttribute<LogTableAttribute>() != null ||
|
(entityType.GetCustomAttribute<LogTableAttribute>() != null ||
|
||||||
entityType.GetCustomAttribute<TenantAttribute>() != 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;
|
return default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -394,7 +394,7 @@ public static class SqlSugarExtension
|
|||||||
{
|
{
|
||||||
if (entityType.GetCustomAttribute<LogTableAttribute>() == null)
|
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;
|
return default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -403,7 +403,7 @@ public static class SqlSugarExtension
|
|||||||
var att = entityType.GetCustomAttribute<TenantAttribute>(); // 自定义的库
|
var att = entityType.GetCustomAttribute<TenantAttribute>(); // 自定义的库
|
||||||
if (att == null || att.configId.ToString() != config.ConfigId.ToString())
|
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;
|
return default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -413,7 +413,7 @@ public static class SqlSugarExtension
|
|||||||
var seedData = ((IEnumerable)hasDataMethod?.Invoke(instance, null))?.Cast<object>().ToArray() ?? [];
|
var seedData = ((IEnumerable)hasDataMethod?.Invoke(instance, null))?.Cast<object>().ToArray() ?? [];
|
||||||
if (seedData.Length == 0)
|
if (seedData.Length == 0)
|
||||||
{
|
{
|
||||||
Console.WriteLine($" 忽略 {seedType.FullName,-58} ({dbProvider.CurrentConnectionConfig.ConfigId}) 原因:没有数据");
|
Console.WriteLine($" 忽略 {seedType.FullName,-58} ({dbProvider.CurrentConnectionConfig.ConfigId}) 原因: 没有种子数据");
|
||||||
return default;
|
return default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user