I have a .NET Standard library that contains all of my SQL related code. It even has some code in it that creates the SQL connection. This library needs to read from the application config file in order to grab the SQL connection string. The library is using the typical ConfigurationManager.ConnectionStrings
approach.
Now, I use this library in a .NET Core ASP.NET Web Api 2 application. I've got my connection string defined in this application's appsettings.json
file. The connection string is in the ConnectionStrings
field with a given name that matches the name that my DLL from above looks for.
This does not appear to work. My DLL, from the top section, does not find the connection string from the config file.
Does ConfigurationManager
not work with appsettings.json
? If not, how should I approach this?