Connection String question - accessing one string throughout solut

G

Guest

I was wondering if it was possible to store a connection string only once in
a single config file, and let it be accessible to every project in the
solution (web included). This way if the connection string needs to be
altered, it only needs to be changed in one place without having to worry
about consistency issues. Thanks for any help.
 
A

AMDRIT

If all the applications are on one computer, you could use machine.config.
If not, then you would have a mess of dependency issues, the server that the
file is stored on, would always have to be up and accessible and then it
wouldn't be an app/web config file. Rather, it would be a simple text file
with the connection string stored in it.

Additionally, environmental settings shouldn't be simply changed without a
process for testing the affect. That is why when the config files are
changes (winform and webform) the assembly spawns a new instance of itself
and orphans existing instances.

Certainly you can achieve as you ask, I only caution the feasibility.

Create a text file or xml file. Place it on a common store, have the
applications parse the file to get the connection string.
 
G

Guest

Thanks for the reply. Just a little more background info on how my solution
is set up... The entire solution consists of many different projects, each
with their own separate .dll's and assembly info. Considering this, would it
still be possible to do as you suggested?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top