🐛 修复多库数据库偶先bug
This commit is contained in:
@@ -414,9 +414,9 @@ namespace ZR.CodeGenerator
|
||||
OptionsSetting optionsSetting = new();
|
||||
|
||||
var gen = AppSettings.Get<Gen>("gen");
|
||||
var dbConfigs = AppSettings.Get<List<DbConfigs>>("dbConfigs");
|
||||
var dbConfig = dbConfigs.FirstOrDefault(f => f.IsGenerateDb);
|
||||
optionsSetting.DbConfigs = dbConfigs;
|
||||
var dbConfig = AppSettings.Get<DbConfigs>("CodeGenDbConfig");
|
||||
|
||||
optionsSetting.CodeGenDbConfig = dbConfig;
|
||||
optionsSetting.Gen = gen ?? throw new CustomException("代码生成节点配置异常");
|
||||
optionsSetting.Gen.GenDbConfig = dbConfig ?? throw new CustomException("代码生成节点数据配置异常");
|
||||
List<GenTableColumn> genTableColumns = new();
|
||||
|
||||
@@ -20,9 +20,8 @@ namespace ZR.CodeGenerator
|
||||
/// <returns></returns>
|
||||
public SqlSugarClient GetSugarDbContext(string dbName = "")
|
||||
{
|
||||
List<DbConfigs> dbConfigs = AppSettings.Get<List<DbConfigs>>("dbConfigs");
|
||||
DbConfigs configs = AppSettings.Get<DbConfigs>("CodeGenDbConfig");
|
||||
|
||||
DbConfigs configs = dbConfigs.Find(f => f.IsGenerateDb == true);
|
||||
string connStr = configs.Conn;
|
||||
|
||||
if (!string.IsNullOrEmpty(dbName))
|
||||
|
||||
@@ -17,8 +17,7 @@ namespace ZR.CodeGenerator.Service
|
||||
{
|
||||
var db = GetSugarDbContext();
|
||||
//Oracle库特殊处理
|
||||
List<DbConfigs> dbConfigs = AppSettings.Get<List<DbConfigs>>("dbConfigs");
|
||||
DbConfigs configs = dbConfigs.Find(f => f.IsGenerateDb == true);
|
||||
DbConfigs configs = AppSettings.Get<DbConfigs>(nameof(GlobalConstant.CodeGenDbConfig));
|
||||
if (configs.DbType == 3)
|
||||
{
|
||||
return new List<string>() { configs?.DbName };
|
||||
|
||||
Reference in New Issue
Block a user