C# IOptionsSnapshot获取所有注册名称
使用C# IOptionsSnapshot获取所有注册名称,c#,.net,C#,.net,使用Microsoft.Extensions.Options.IOptionsSnapshot可以多次配置一个配置类 想象一下我有: { "MyObject": { "AnotherObject": { "Address": { "City": "..." } // Will be named as "MyObject:AnotherObj
Microsoft.Extensions.Options.IOptionsSnapshot
可以多次配置一个配置类
想象一下我有:
{
"MyObject": {
"AnotherObject": {
"Address": { "City": "..." } // Will be named as "MyObject:AnotherObject:Address" in the snapshot
}
},
"AnotherSetting": {
"Address": { "City": "..." }
// This object will be registered with a Guid.ToString()
// (I cannot change the package registering it)
}
"FavoriteAddresses" {
"Home": { "City": "..." },
"Work": { "City": "..." },
"Parents": { "City": "..." },
// ...... Unlimited list
}
}
我必须处理以下限制:
- 我无法更改我的
类以添加地址
属性并将名称
转换为数组收藏夹地址
- 我既不能应用继承,也不能在这个
类周围使用包装器地址
地址
选项的所有注册名称列表?