在我的ASP.NET 5(RC1)代码中,我有一个类似于以下内容的appsetting.json:
{
"SomeSettings": {
"PropA": "ValueA",
"PropB": [
"ValueB1",
"ValueB2"
]
}
}
这些值用于在我的开发机(即本地主机)上运行代码。如果我想要覆盖Azure Web应用程序的应用程序设置中的"SomeSettings",我应该如何指定"PropB"数组?
我想存储信息的SomeSettings.cs类看起来像这样:
public class SomeSettings
{
public string PropA { get; set; }
public List<string> PropB { get; set; }
}
问题是“PropB” - 如何在Azure中将数组或列表指定为字符串 - 这是否可能?在我的Startup类构造函数中,我有:
var builder = new ConfigurationBuilder()
.AddJsonFile("appsettings.json")
.AddEnvironmentVariables();
在我的 Startup 类的 Configure 方法中,我有:
var someSettings = configuration.GetSection("SomeSettings").Get<SomeSettings>();
SomeSettings__PropB
表示为空数组吗? - gabeSomeSettings__PropA__object__value
但好像无法正确设置。 - Wouter Vanherck