[성현모] TRA GetDBContext 기능 추가
This commit is contained in:
@ -4,6 +4,7 @@ using SystemX.Core.Config.Model;
|
||||
using SystemX.Core.DB;
|
||||
using SystemX.Core.Services;
|
||||
using Web.Tra.Components;
|
||||
using Web.Tra.Services;
|
||||
using WebClient.Library.Config;
|
||||
using WebClient.Library.Model;
|
||||
|
||||
@ -26,6 +27,9 @@ var builder = WebApplication.CreateBuilder(args);
|
||||
//singleton
|
||||
builder.Services.AddSingleton<ConfigService<WebClientConfig>>();
|
||||
|
||||
//scoped
|
||||
builder.Services.AddScoped<CPXV2LogService>();
|
||||
|
||||
//db
|
||||
builder.Services.AddSingleton<DbContextProvider>(); // Generic <20><><EFBFBD><EFBFBD>
|
||||
|
||||
@ -39,7 +43,7 @@ builder.Services.AddRadzenComponents();
|
||||
ConfigService<WebClientConfig> preloadConfig = new ConfigService<WebClientConfig>();
|
||||
if (preloadConfig.OpenConfig($@"{configDir}/{configFileName}") == true)
|
||||
{
|
||||
var config = preloadConfig.GetConfig();
|
||||
var config = preloadConfig.GetConfig();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -74,18 +78,30 @@ if (configService?.OpenConfig($@"{configDir}/{configFileName}") == true)
|
||||
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)))
|
||||
foreach (var db in longTermDB)
|
||||
{
|
||||
logDb.Add(new DataBase
|
||||
try
|
||||
{
|
||||
DBID = db.index,
|
||||
DBName = db.value.Name,
|
||||
IP = "127.0.0.1",
|
||||
Port = 1433,
|
||||
UserID = "Alis",
|
||||
Password = "Kefico!@34",
|
||||
DBContext = ""
|
||||
});
|
||||
var year = db.Name.Split("_")[1];
|
||||
if(Int32.TryParse(year, out var index))
|
||||
{
|
||||
logDb.Add(new DataBase
|
||||
{
|
||||
DBID = index,
|
||||
DBName = db.Name,
|
||||
IP = "127.0.0.1",
|
||||
Port = 1433,
|
||||
UserID = "Alis",
|
||||
Password = "Kefico!@34",
|
||||
DBContext = ""
|
||||
});
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
LogXnet.WriteLine("DB Register Exception");
|
||||
LogXnet.WriteLine(e);
|
||||
}
|
||||
}
|
||||
|
||||
dbProvider.SetDBList(logDb);
|
||||
|
||||
Reference in New Issue
Block a user