, reloadOnChange, IOptionsSnapshot<T> IOptions<T>. , T. :
services.Configure<AppSettings>(Configuration.GetSection("AppSettings"));
, , , ASP.NET Core 2.0 . , WebHostBuilder, ConfigureAppConfiguration. :
public static IWebHost BuildWebHost()
=> new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.ConfigureAppConfiguration((builderContext, config) =>
{
IHostingEnvironment env = builderContext.HostingEnvironment;
config.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
config.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
})
.UseStartup<Startup>()
.Build();
WebHost.CreateDefaultBuilder(), , , reloadOnChange.
IOptionsSnapshot IOptionsMonitor , IOptionsSnapshot IOptionsSnapshot<T>.
, IOptions<T>: , options.Value , . . , IOptionsSnapshot<T> , singleton, IOptions<T>, , .
IOptionsMonitor<T> - , . singleton, , . , push . , .
, . , , , . , . - (, , ..). , , .