如何检查哪些配置文件/设置已更改?
我已经配置了ChangeToken.OnChange()
方法来检测对配置文件的更改
var configuration = new ConfigurationBuilder()
.AddJsonFile("settings1.json", optional: true, reloadOnChange: true)
.AddJsonFile("settings2.json", optional: true, reloadOnChange: true);
.Build();
// register change callback
ChangeToken.OnChange(
() => configuration.GetReloadToken(),
() => {
logger.Info("Configuration file has been changed"); //want to know specifically what has changed
}
);
这可以检测到settings1.json和settings2.json的任何更改,但是我想知道哪个文件已更改以及哪个属性已更改?