我正在使用.NET Core在Azure Functions中使用EF Core 2.0。我试图从local.settings.json文件中读取数据库连接字符串,它的定义如下:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"AzureWebJobsDashboard": "UseDevelopmentStorage=true"
},
"ConnectionStrings": {
"MyDbConnStr": "Data Source=.;Initial Catalog=xxxxxxx"
}
}
Environment.GetEnvironmentVariable()方法不返回任何连接字符串的信息,同时我也无法在 .net core 中使用 ConfigurationManager.ConnectionStrings。 那么我该如何从代码中访问连接字符串?