问题
I'm currently developing DLLs in .NET that use Entity Framework to access our database.
It is my understanding that DLLs do not have ties with the same App.config files as exe applications do. Through a good amount of research, I have learned that DLLs do not contain App.config and are best left agnostic(config) so the program using the DLL can determine the config.
I'm receiving this error and am sure that the connection string is defined in my app.config:
System.InvalidOperationException: No connection string named 'MyEntities' could be found in the application config file.
I'm positive that I would like the config file to always be the same DLL and would appreciate any suggestions that may point me towards "best practices" in achieving this implementation.
Thanks in advance,
Russ
来源:https://stackoverflow.com/questions/27494015/referencing-app-config-file-through-a-net-class-library-dll-in-coldfusion-9