using Microsoft.Extensions.Configuration; namespace MarketData.Configuration { /// /// This is a class that allows my legacy code to interact with the jsonsettings.config without requiring a complete rewrite of everything into dependency injection /// The class need to be instantiated at program entry point and initilized with IConfigurationRoot /// public class GlobalConfig { private static GlobalConfig globalConfig = default; private GlobalConfig() { } public static GlobalConfig Instance { get { lock (typeof(GlobalConfig)) { if (null == globalConfig) { globalConfig = new GlobalConfig(); } return globalConfig; } } } public IConfiguration Configuration { get; set; } = default; } }