20-11-23
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user