I have 2 projects: Console Application and Class Library (dll)
My main project, the console app, references my dll.
In my dll I created an EF (Entity Framework) ADO model.
The EF connection string must be in the dll project .config
file.
The problem is when I initialize a DbContext
it is looking for the connection string in the Console Application .config
file.
How can I tell the DbContext
to look for the connection string in the dll .config
file ?
Thanks
That's how config files work. The running app always looks in {appname}.exe.config. The config file for the DLL project is just there to give you placeholders that must be copied to the running app's config file. It is not deployed along with the DLL.
You should specify your connection string in your console app. Here is a quick example why you want to do that.
And there are a lot more arguments to why you really want to do it. All the tools are built around it too.