(без внедрения зависимостей или ASP.NET Core).
Я уже пробовал. Как связать многоуровневый объект конфигурации с помощью IConfiguration в приложении .net Core? но похоже, что .Get() удален из netcoreapp1.1
Код: Выделить всё
IConfigurationSection myListConfigSection = configurationRoot.GetSection("ListA");
List
paramList;
//Get does not exist
//paramList = myListConfigSection.Get();
string paramListJson = myListConfigSection.Value // is null
// won't work neither because paramListJson is null
paramList = JsonConvert.DeserializeObject(paramListJson);
Код: Выделить всё
{
"ListA": [
{ "ID": "123", "Param": "ABC"},
{ "ID": "123", "Param": "JKS"},
{ "ID": "456", "Param": "DEF"}
]
}
Подробнее здесь: https://stackoverflow.com/questions/450 ... p-net-core
Мобильная версия