How to obtain the OnChange event triggered after appsettings.json manually modifies and saves in asp.net core?

encountered a requirement. After modifying the appsettings.json file, you need to trigger a cascading event with modified settings. Does anyone know how to get this OnChange event?

configure the appsettings.json code as follows:

new ConfigurationBuilder()
        .SetBasePath(environment.ContentRootPath)
        .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
Jun.09,2021

looked at the source code of Microsoft.Extensions.Configuration .
found that JsonConfigurationProvider 's base class ConfigurationProvider has a protected void OnReload () , so the solution is clear.
inherits JsonConfigurationProvider to create a new Provider , and then override OnReload method.

then in Program.cs

public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
    WebHost.CreateDefaultBuilder(args)
        .ConfigureAppConfiguration((builderContext, config) =>
         {     
            IHostingEnvironment env = builderContext.HostingEnvironment;
             var c = config as Microsoft.Extensions.Configuration.ConfigurationBuilder;
            //c.Sourcesappsettings.json  JsonConfigurationProvider
            //c.SourcesProviderc.SourcesList
         })
         .UseStartup<Startup>();
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea56ba-47b2c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea56ba-47b2c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?