[성현모] TRA DB목록 불러오기, 정의 자동추가
This commit is contained in:
@ -1,11 +1,15 @@
|
||||
@inherits LayoutComponentBase
|
||||
@using SystemX.Core.Services
|
||||
@using WebClient.Library.Config
|
||||
|
||||
@inherits LayoutComponentBase
|
||||
@inject ConfigService<WebClientConfig> configService
|
||||
|
||||
<RadzenComponents @rendermode="InteractiveServer" />
|
||||
<RadzenLayout>
|
||||
<RadzenHeader>
|
||||
<RadzenStack Orientation="Orientation.Horizontal" AlignItems="AlignItems.Center" Gap="0">
|
||||
<RadzenSidebarToggle Click="@(() => sidebarExpanded = !sidebarExpanded)" />
|
||||
<RadzenLabel Text="Header" />
|
||||
<RadzenLabel Text="@configService?.GetConfig()?.ApplicationName" />
|
||||
</RadzenStack>
|
||||
</RadzenHeader>
|
||||
<RadzenSidebar @bind-Expanded="@sidebarExpanded">
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,5 +13,8 @@ namespace WebClient.Library.Config
|
||||
{
|
||||
[JsonPropertyName("DataBase")]
|
||||
public List<DataBase>? DataBase { get; set; }
|
||||
|
||||
[JsonPropertyName("ApplicationName")]
|
||||
public string? ApplicationName { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
13
Projects/WebClient/WebClient.Library/Model/DBList.cs
Normal file
13
Projects/WebClient/WebClient.Library/Model/DBList.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WebClient.Library.Model
|
||||
{
|
||||
public class DBList
|
||||
{
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user