The company I work for would like to rewrite a MVC 5 application in ASP.NET Core 1.0 web applciation. The core DAL layer we use is using EF 6.13 has its assemblies packed into a nuget package which is published on an inteal server. This nuget package has been installed in the legacy MVC 5 application (along with several other projects). In the legacy MVC 5 application the Context coection string is put into the web.config file and everything works great.
<coectionStrings>
<add name="OurContext" coectionString="Data Source=xxx;Initial Catalog=xxx;user id=xxx;password=xxx;" providerName="System.Data.SqlClient" />
I have installed the DAL nuget package in the new ASP.NET Core 1.0 project and everything build correctly. The problem is that I am at a loss where to create the coection string that the nuget package DAL assemblies that use EF 6 require. I have tried adding it to the appsettings.json file in the "Data" node:
{
"Data": {
"IdentityCoection": {
"CoectionString": "Server=xxx;Database=xxx;Trusted_Coection=True;MultipleActiveResultSets=true"
},
"OurContext": {
"CoectionString": "Data Source=xxx;Initial Catalog=xxx;user id=xxx;"
}
},
"Logging":...
And also as its own node:
{
"Data": {
"IdentityCoection": {
"CoectionString": "Server=xxx;Database=xxx;Trusted_Coection=True;MultipleActiveResultSets=true"
},
"OurContext": {
"CoectionString": "Data Source=xxx;Initial Catalog=xx;user id=xx;password=xx;"
},
"Logging": {....
I have also tried adding the "normal" coection string keys in the 'wwwroot''s web.config.
Every time I try to access the db I get the standard 'The underlying provider failed on Open.' error message. I'm assuming this is because the assemblies in the DAL nuget package that creates the Context can't find the correct coection string to use.
Can anybody help out? Thanks!
