using application configuratioin files

  • Thread starter Thread starter scorpion53061
  • Start date Start date
Hello Ohad,

Well you could have a seperate XML file for your DLL (as another poster has
suggested).
Personally, I'd avoid that path, simply because it means that your common
DLL will create a situation: every app that uses it will require two config
files to deploy. This is NOT a better alternative to providing one config
file.

The way that config files are structured, you can add any level of detail to
the same config file by declaring your own config section handler. There
are examples of doing this scattered around the web. That will allow you to
add your own config section the the application config file, and thus, you
won't get any conflicts.

From experience: if you create a library that requires its own config file
to deploy, other programmers may be averse to use it, and you will lose any
value from making your library "generic" enough for reuse.

Good Luck,
--- Nick
 
Hi,

I have developed a distributed application. One of its components is a dll
(for example, the data access layer object) file in which I'd like to use a
configuration file for storing various application settings (for example, DB
connection string).
However, dll projects cannot use the .NET app.config file (only web apps. or
exe projects are supported).

How can I store these settings in an outside file (not part of the code)?
Is there a way to use .NET app.config file from a dll?

Thanks in advance, Ohad

--
Ohad Young
Medical Informatics Research Center
Ben Gurion University
Information System Eng
Office Phone: 972-8-6477160
Cellular Phone: 972-54-518301
E-Mail: (e-mail address removed)
 
Good point Nick.

Nick Malik said:
Hello Ohad,

Well you could have a seperate XML file for your DLL (as another poster
has
suggested).
Personally, I'd avoid that path, simply because it means that your
common
DLL will create a situation: every app that uses it will require two
config
files to deploy. This is NOT a better alternative to providing one
config
file.

The way that config files are structured, you can add any level of detail
to
the same config file by declaring your own config section handler.
There
are examples of doing this scattered around the web. That will allow you
to
add your own config section the the application config file, and thus,
you
won't get any conflicts.

From experience: if you create a library that requires its own config
file
to deploy, other programmers may be averse to use it, and you will lose
any
value from making your library "generic" enough for reuse.

Good Luck,
--- Nick
 
The DLL will use the config file for the hosting EXE, you can add the
setting in the exe.config and read it from the DLL.

Chris
 
Hi all,

Thanks for the advises.
Suppose I use a config file from the main app., for example a webservice
app.
Will the library component have access to the webservice web.config
settings?

My point is that I'd still like to seperate site-specific settings and
constants from the component's code.
Thus, in order to update these settings if changes occur, the config
file will be updated without needing to recomplie the component.

Ohad



*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Back
Top