Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Passing parameters best practice

1 view
Skip to first unread message

tshad

unread,
Aug 9, 2006, 2:14:35 PM8/9/06
to
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?


no potted meat@hotmail.com David Browne

unread,
Aug 9, 2006, 2:22:56 PM8/9/06
to

"tshad" <tschei...@ftsolutions.com> wrote in message
news:uftvs%239uGH...@TK2MSFTNGP02.phx.gbl...

Don't mulitpost.


Michael Nemtsev

unread,
Aug 9, 2006, 2:36:50 PM8/9/06
to
Hello tshad,

From you list only 2 different approach available - file or DB. What to use
is up to u and depends on you project

Some explanations
app.config is a native solution for the .net xml world
registry is too specific storage to the local user/machine

t> I need to pass a few parameters to my Windows Service program. The
t> end user will be changing the parameters and settings should be
t> saved.
t>
t> What is the best practice
t> - use app.config
t> - use .ini file
t> - use Registry
t> - write a Windows Application program and save the settings to
t> database
t> table
t> should I trust the end user to modify registry, .config or .ini file?
t>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche


Ignacio Machin ( .NET/ C# MVP )

unread,
Aug 9, 2006, 3:34:36 PM8/9/06
to
Hi,


"tshad" <tschei...@ftsolutions.com> wrote in message
news:uftvs%239uGH...@TK2MSFTNGP02.phx.gbl...

>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.

A windows service with end user interaction?

> What is the best practice
> - use app.config

Read only

> - use .ini file
Possible, I prefer this option

> - use Registry
Possible

> - write a Windows Application program and save the settings to database
> table

You will have to, a window service has not user interaction. You should
write a win app to allow configuration changes.
If you use a file you could use a FileSystemWatcher to detect changes in the
config file and reload the configurations.


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

Never instruct an end user to change the registry !!!


--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


tshad

unread,
Aug 9, 2006, 5:08:56 PM8/9/06
to
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:uSDKar%23uGH...@TK2MSFTNGP05.phx.gbl...

> Hi,
>
>
> "tshad" <tschei...@ftsolutions.com> wrote in message
> news:uftvs%239uGH...@TK2MSFTNGP02.phx.gbl...
>>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.
>
> A windows service with end user interaction?

Actually, this was also for non-service non-web applications. But I want to
be able to allow my boss to make changes to the fields - such as email
addresses or Web sites to monitor. Then when he restarts the Windows
service, it would pick up the changes. I don't want him to have to go to
the file on the server to make the changes.

>
>> What is the best practice
>> - use app.config
> Read only
>
>> - use .ini file
> Possible, I prefer this option

I liked this one also. Easy to modify.

>
>> - use Registry
> Possible
>
>> - write a Windows Application program and save the settings to database
>> table
>
> You will have to, a window service has not user interaction. You should
> write a win app to allow configuration changes.
> If you use a file you could use a FileSystemWatcher to detect changes in
> the config file and reload the configurations.
>
>
>> should I trust the end user to modify registry, .config or .ini file?
>
> Never instruct an end user to change the registry !!!
>

You're right, of course.

Thanks,

Tom

0 new messages