[성현모] TRA DB목록 불러오기, 정의 자동추가
This commit is contained in:
@ -1,7 +1,11 @@
|
||||
using Microsoft.EntityFrameworkCore.Storage;
|
||||
using Radzen;
|
||||
using SystemX.Core.Config.Model;
|
||||
using SystemX.Core.DB;
|
||||
using SystemX.Core.Services;
|
||||
using Web.Tra.Components;
|
||||
using WebClient.Library.Config;
|
||||
using WebClient.Library.Model;
|
||||
|
||||
string configDir = @"../../Config";
|
||||
string configFileName = "WebClient.Tra.Config.json";
|
||||
@ -63,6 +67,28 @@ if (configService?.OpenConfig($@"{configDir}/{configFileName}") == true)
|
||||
{
|
||||
var dbProvider = scoped.ServiceProvider.GetRequiredService<DbContextProvider>();
|
||||
dbProvider?.SetDBList(apiConfig?.DataBase);
|
||||
|
||||
//log db list
|
||||
var dbcontext = dbProvider.GetDBContext<CPXV2>("CPXV2");
|
||||
var getDbList = await dbcontext.ExecuteStoredProcedureAsync<CPXV2, DBList>("spGetDBList");
|
||||
var longTermDB = getDbList.Where(x => x.Name.ToLower().Contains("longterm")).ToList();
|
||||
|
||||
List<DataBase> logDb = new List<DataBase>();
|
||||
foreach (var db in longTermDB.Select((value,index) => (value, index)))
|
||||
{
|
||||
logDb.Add(new DataBase
|
||||
{
|
||||
DBID = db.index,
|
||||
DBName = db.value.Name,
|
||||
IP = "127.0.0.1",
|
||||
Port = 1433,
|
||||
UserID = "Alis",
|
||||
Password = "Kefico!@34",
|
||||
DBContext = ""
|
||||
});
|
||||
}
|
||||
|
||||
dbProvider.SetDBList(logDb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user