Passing parameters best practice

  • Thread starter Thread starter tshad
  • Start date Start date
T

tshad

I need to pass a few parameters to my Windows Service program. The end user
will be changing the parameters and settings should be saved.

What is the best practice
- use app.config
- use .ini file
- use Registry
- write a Windows Application program and save the settings to database
table

should I trust the end user to modify registry, .config or .ini file?

Thanks,

Tom
 
I think no matter what mechanism you use, you should have a front end
interface for the user to use. The user shouldn't have to dig into the
registry, or the config file of the application.

These various places have various degrees of security. If your parameters
don't need to be secure, then you could go either the registry route, or
app.config.

No matter what route you take, you will need to restart your windows service
to pick up the new configuration settings.
 
My preferred route these days is a custom configuration section/handler.

http://support.microsoft.com/kb/309045/EN-US/

After you do 1 or 2 of them (aka, get past the struggle part), they are
simple to write.

It gives you a true "object" at the end of the day to encapsulate your
values...instead of always getting the app/key/value.
It keeps the app.config file organized and neat also.
 
Back
Top