If you desperately need some sort of "per-assembly" config files, you might
consider also using Mike Woodring's nice little extension class, which
allows you to use dll.config files:

http://www.develop.com/devresources/resourcedetail.aspx?type=t&id=852

Bruce


-----Original Message-----
From: Mitch Denny [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 13, 2002 5:53 PM
To: [EMAIL PROTECTED]
Subject: Re: [DOTNET] .config for Class Library

Nischal,

Configuration files are assigned on a per-AppDomain
basis so the only way you could have a different
configuration file to AppName.exe.config is if in
each of your classes you pointed to an AppDomain
just for their functionality.

I wouldn't recommend this since it would complicate
your implementation significantly for very little
benefit. Is there any particular reason you don't
want to persist the connection string in the
default configuration file?

If you want to mark the string out in the config
file you could implement a custom configuration
handler so that it was something like:

        <?xml version="1.0" encoding="utf-8" ?>

        <configuration>

                <yourlibrary>

                        <settings>

                                <setting name="db" value="..." />

                        </settings>

                </yourlibrary>

        </configuration>

Look up the System.Configuration namespace, its
fairly straight-forward in terms of implementation.

----------------------------------------
- Mitch Denny
- [EMAIL PROTECTED]
- +61 (414) 610-141
-

-----Original Message-----
From: The DOTNET list will be retired 7/1/02
[mailto:[EMAIL PROTECTED]] On Behalf Of Nischal Muthana
Sent: Friday, 14 June 2002 10:13
To: [EMAIL PROTECTED]
Subject: [DOTNET] .config for Class Library


Hi All

I created a C# class library with couple of .cs files
in it. One of the class connects to the database and
does some inserting. My question here is, Can I have a
config file in which I can specify the connection
string of the database instead of specfying in the
class.

I know there is something called Appname.exe.config
for the exe based applications. And also I looked at
the machine.config option. But nobody wants me touch
the production box and play with machine.config.

So is there a way I can I have a config file for the
class libraries(dll)

Thanks
Nischal

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to