accessing connection string in data access layer

T

Tirrell Cotton

I've created a small n-tiered application similar to the one created in this
demo video:

http://windowsclient.net/learn/video.aspx?v=14625&CommentPosted=true#commentmessage

The application has all of it's data access code in a seperate class library
that uses strong typed datasets and table adapters. This class library also
contains an app.config file that stores the connection string to the
database. When the project is deployed it is a .dll file (like all class
library projects). How can I change the connection string without
re-compiling the project?
 
P

Peter Morris

Change myapplication.exe.config and the app doesn't need to be recompiled,
but you do need to read the string using the ConfigurationManager class.


--
Pete
=========================================
I use Enterprise Core Objects (Domain driven design)
http://www.capableobjects.com/
=========================================
 
M

Morten Wennevik [C# MVP]

Hi Tirrell,

The executing application needs to have a application config/web.config file
which copies the app settings from the dll. This needs to be copied exactly
or the dll will revert to the default setting. In case of user or application
settings remember to copy the sectiongroup as well.
 

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