我有一個ASP .NET MVC 6和實體框架6,分爲幾層,我如何在DbContext中的DAL層獲取連接字符串? 連接字符串是這樣appsettings.json文件:ASP .NET MVC層DAL
{
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Verbose",
"System": "Information",
"Microsoft": "Information"
}
},
"Data": {
"DefaultConnection": {
"ConnectionString": "",
}
}
}
我猜你添加一個構造函數說參數並推動它? – Carsten