This commit is contained in:
Jonathan Jenne
2023-11-20 16:42:11 +01:00
parent 624266a971
commit 56688d2690
18 changed files with 305 additions and 59 deletions

View File

@@ -15,6 +15,8 @@ namespace EnvelopeGenerator.Web.Services
public ElementModel elementModel;
public HistoryModel historyModel;
public DocumentStatusModel documentStatusModel;
public EmailModel emailModel;
public ConfigModel configModel;
public ModelContainer(State state)
{
@@ -24,6 +26,8 @@ namespace EnvelopeGenerator.Web.Services
elementModel = new(state);
historyModel = new(state);
documentStatusModel = new(state);
emailModel = new(state);
configModel = new(state);
}
}
public readonly ModelContainer? Models;
@@ -39,8 +43,17 @@ namespace EnvelopeGenerator.Web.Services
{
logger.Debug("MSSQL Connection: [{0}]", MSSQL.CurrentConnectionString);
// There is a circular dependency between state and models
// All models need a state object, including the config Model
// The state object needs to be filled with the DbConfig property,
// which is obtained by the config Model.
// So first, the config model is initialized with an incomplete state object,
// then all the other models with the DbConfig property filled.
var state = GetState();
Models = new(state);
var configModel = new ConfigModel(state);
state.DbConfig = configModel.LoadConfiguration();
Models = new(state);
}
else
{