Application Config File - Running a training and production system on the same exe

  • Thread starter Thread starter sridhar
  • Start date Start date
I would try to stay away from using the registry and or
ini files, and stick with XML or the app.config files.

For your problem how about having the default connections
for say the production system stored in the app config
file. and when the system is run from the command line
over ride the app.config files in the program.

For example the Test server is called test01 and
production is prod01. In the config file you would have
the database connection string connecting to the prod01
machine. then when the app runs with no command line args
it would use the prod01 machine. Now in the code
configure it to check if command line args were passed,
if they validate then override the reading of the
app.config and use command line args.

Glenn Wilson
 
Thanks,

Are you saying that it is still acceptable [within the .NET apps] to
pass command-line arguments? or is there another recommended approach?

I just thought that command arguments would be redundant with the
advent of the app.config files.

If command-line is OK, then we're fine to go with what you've
suggested, but will probably be more explicit in always providing an
argument. This will allow for multiple databases if and when they are
required.

Thanks Again,

Jan-Willem Wilson.
 
Back
Top