Initial Commit
This commit is contained in:
34
MarketData/MarketDataLib/Configuration/GlobalConfig.cs
Executable file
34
MarketData/MarketDataLib/Configuration/GlobalConfig.cs
Executable file
@@ -0,0 +1,34 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace MarketData.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// 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
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user