This commit is contained in:
Jonathan Jenne
2024-01-16 09:44:48 +01:00
parent 0a01bf59ef
commit 6131948f2a
13 changed files with 223 additions and 61 deletions

View File

@@ -6,6 +6,7 @@ namespace EnvelopeGenerator.Web.Services
public class DatabaseService: BaseService
{
public MSSQLServer MSSQL { get; set; }
public IConfiguration Config { get; set; }
public State State { get; set; }
@@ -47,12 +48,13 @@ namespace EnvelopeGenerator.Web.Services
public readonly ModelContainer? Models;
public readonly ServiceContainer? Services;
public DatabaseService(IConfiguration Config, LoggingService Logging) : base(Config, Logging)
public DatabaseService(IConfiguration pConfig, LoggingService pLogging) : base(pConfig, pLogging)
{
logger = Logging.LogConfig.GetLogger();
logger = pLogging.LogConfig.GetLogger();
Config = pConfig;
logger.Debug("Establishing MSSQL Database connection..");
MSSQL = new MSSQLServer(logConfig, Config["Config:ConnectionString"]);
MSSQL = new MSSQLServer(logConfig, pConfig["Config:ConnectionString"]);
if (MSSQL.DBInitialized == true)
{
@@ -71,6 +73,11 @@ namespace EnvelopeGenerator.Web.Services
}
}
public string? GetAppSetting(string key)
{
return Config[key];
}
/// <summary>
/// There is a circular dependency between state and models
/// All models need a state object, including the config Model