in src/Microsoft.Extensions.Configuration.AzureAppConfiguration/AzureAppConfigurationProvider.cs [1364:1415]
private async Task ProcessKeyValueChangesAsync(
IEnumerable<KeyValueChange> keyValueChanges,
Dictionary<string, ConfigurationSetting> mappedData,
Dictionary<KeyValueIdentifier, ConfigurationSetting> watchedIndividualKvs)
{
foreach (KeyValueChange change in keyValueChanges)
{
KeyValueIdentifier changeIdentifier = new KeyValueIdentifier(change.Key, change.Label);
if (change.ChangeType == KeyValueChangeType.Modified)
{
ConfigurationSetting setting = change.Current;
ConfigurationSetting settingCopy = new ConfigurationSetting(setting.Key, setting.Value, setting.Label, setting.ETag);
watchedIndividualKvs[changeIdentifier] = settingCopy;
foreach (Func<ConfigurationSetting, ValueTask<ConfigurationSetting>> func in _options.Mappers)
{
setting = await func(setting).ConfigureAwait(false);
}
if (setting == null)
{
mappedData.Remove(change.Key);
}
else
{
mappedData[change.Key] = setting;
}
}
else if (change.ChangeType == KeyValueChangeType.Deleted)
{
mappedData.Remove(change.Key);
watchedIndividualKvs.Remove(changeIdentifier);
}
// Invalidate the cached Key Vault secret (if any) for this ConfigurationSetting
foreach (IKeyValueAdapter adapter in _options.Adapters)
{
// If the current setting is null, try to pass the previous setting instead
if (change.Current != null)
{
adapter.OnChangeDetected(change.Current);
}
else if (change.Previous != null)
{
adapter.OnChangeDetected(change.Previous);
}
}
}
}