I've got a DAL with EntityFramework 6 running in .NET Framework 4.6.1 as a project. Works fine in solutions with other .NET Framework projects. Now am I going to use same DAL project referenced to my ASP.NET Core WebApi (using .NET Framework 4.6.1) and it doesn't work. The exception says:
No connection string named 'MyEntities' could be found in the application config file.
.NET Core project does not hava a web.config file, so EF6 How can I pass settings from appsettings.json in my Core project to the referenced DAL project?
I've found some examples to get EF6 working inside .NET Core projects (like https://docs.microsoft.com/en-us/aspnet/core/data/entity-framework-6), but it doesn't help me. I guess that's becouse the dbcontext is created inside the DAL project.
appsettings.json
"ConnectionStrings": {
"MyEntities": "<my connectionString>"
},
project.json
"dependencies": {
"EntityFramework": "6.1.3",
...
},
...
"frameworks": {
"net461": {
"dependencies": {
"DAL": {
"target": "project"
}
},
"imports": "dnxcore50"
}
},