tags:

views:

32

answers:

3

Hi there,

I have a class library and my other projects are using it. And also i have some connection strings. i want to use them from just class lib's App.config file. But when i use ConfigurationManager in my class lib for reading connection strings, program looks my current project's App.config or Web.config files.

How can i use connection strings from class lib's App.config file?

Thanks in advance

+1  A: 

Copy them from the class lib's config file to the application's config file. See http://stackoverflow.com/questions/1742929/net-app-config-in-library-project

Hightechrider
thanks for your answer, but i want to write conenction strings to only one config file.
Dakmaz
Then you can use your own files (like myConf.xml) and store connection string there. But i fyou want to use App.config, then it has to be in yout end application
Katalonis
A: 

You have to provide a connection string in the end application.

Say you have a library.dll and application.exe

Classes in application.exe use library.dll. And classes in library.dll need connection string from App.config. Then you have to provide the connection string in App.config of your application.exe.

Katalonis
+1  A: 

I think you need a Xml file in your class library. You should read your connection strings from it.

cagin