예제 #1
0
        private static void Call_Config_OnChanged(object obj)
        {
            if (Config_OnChanged != null)
            {
                Config_OnChanged.Dispose();
            }



            Microsoft.Extensions.Configuration.IConfiguration config = (Microsoft.Extensions.Configuration.IConfiguration)((object[])obj)[0];

            Reload();

            /*var appsettings = config.Get<AppSettings>();
             * //TODO:取得最新配置后修改相关业务逻辑
             */


            //重新注册callback,下次appsettings.josn更新后会自动调用
            Config_OnChanged = config.GetReloadToken().RegisterChangeCallback(Call_Config_OnChanged, obj);
        }
 /// <summary>
 /// Returns a change token if this provider supports change tracking, null otherwise.
 /// </summary>
 /// <returns>
 /// The change token.
 /// </returns>
 public IChangeToken GetReloadToken()
 {
     return(_innerConfig.GetReloadToken());
 }