Connection String in app.config of a dll

后端 未结 2 1833
粉色の甜心
粉色の甜心 2021-01-22 21:00

I created a C# dll that uses connection string from app.config file to connect to database.

I use it in a web application (Visual Studio 2013, Windows 7) that a

2条回答
  •  孤城傲影
    2021-01-22 21:18

    Actually the app.config file in your dll (class library project) won't affect the final host application ( in which the dll is used). So you will always need to put the proper connection settings in the host application's config file. For example, if you use the assembly/dll in winform or WPF application, then you should put the related configuration (like connection strings) in the winform or WPF app's app.config file. If the assembly/dll is used in ASP.NET web application, then we should make sure the related settings are put in the web.config file of the web application.

提交回复
热议问题