473,672 Members | 2,754 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Passing parameters best practice

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?
Aug 9 '06 #1
4 1681

"tshad" <ts**********@f tsolutions.comw rote in message
news:eQ******** ********@TK2MSF TNGP04.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.

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?
app.config, posssibly with a Windows Application to modify the app.config.

David
Aug 9 '06 #2
Yes app.config is the best place if this is machine specific. If the settings
are shared between multiple machines then a DB may make sense.

Whatever be the option, you will anyway need a app interface for the user to
maintain these parameters.

--
Rgds,
Anand
VB.NET MVP
http://www.dotnetindia.com
"tshad" wrote:
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?
Aug 10 '06 #3
tshad wrote:
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.
Then they'll need a program to help them do it.
What is the best practice
- use app.config
Not considered "writeable" in .Net applications (at least as far as
VS'2003).
- use .ini file
Or an XML configuration file that you can interrogate using XPath.
- use Registry
Not really recommended anymore - the stupid clogged with too much other
rubbish, it's impossible to back-up reliably and is often protected from
casual (i.e. user) perusal.
- write a Windows Application program and save the settings to database
table
[Big!] Yes to having an editing application.
Where the data gets stored depends on lots of things. For example, will
the user be on the same machine as the Service? If not, most file-based
solutions (including the Registry, which is just a file) go straight out
the window.
should I trust the end user to modify registry, .config or .ini file?
No, definitely not. Indeed, most of them (in commercial organisations)
will be actively prevented from hacking around the Registry.

HTH,
Phill W.
Aug 10 '06 #4
tshad,
What I do is write a Windows Application program that updates the Window's
Services app.config file.

I have the Windows Application restart the service so that it sees the
updated config file.

Currently I am using System.Xml to update the config file, however I'm
thinking the new Configuration namespace in .NET 2.0 (VS 2005) will simplify
changing the config file.

FWIW: The new Configuration namespace in .NET 2.0 definitely simplifies
leveraging the config file!

--
Hope this helps
Jay B. Harlow [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"tshad" <ts**********@f tsolutions.comw rote in message
news:eQ******** ********@TK2MSF TNGP04.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.
|
| 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?
|
|
Aug 12 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2060
by: mheydman | last post by:
I posted this to the notes page of the COM PHP documentation... I will post an update there if I find a solution here. I have need for a commercial COM/DOTNET class library that requires a paramater to be passed when the object is created. It does not appear as though PHP allows for the instantiation of COM/DOTNET objects that require a parameter to be passed to their constructor... I am not sure if I am being clear, but suppose to...
3
14931
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) { document.images.src = eval("mt" +menu+ ".src") } alert("imgOff_hidemenu"); hideMenu=setTimeout('Hide(menu,num)',500);
12
2800
by: Joel | last post by:
Hi all, Forgive me if I've expressed the subject line ill. What I'm trying to do is to call a c++ function given the following: a. A function name. This would be used to fetch a list of function descriptors for the overloaded functions of that name. A function descriptor would contain the address of the function to be called, and a description of the parameters that it must take. b. A list of parameters. This would be compared to the...
10
125447
by: Resant | last post by:
I have a query : Exec 'Select * From Receiving Where Code In (' + @pCode + ')' @pCode will contain more than one string parameter, eg : A1, A2, A3 How can i write that parameters, I try use : set @pCode='A1','A2','A3' but get an error : Incorrect syntax near ','
8
2115
by: Dennis Myrén | last post by:
I have these tiny classes, implementing an interface through which their method Render ( CosWriter writer ) ; is called. Given a specific context, there are potentially a lot of such objects, each requiring a call to that method to fulfill their purpose. There could be 200, there could be more than 1000. That is a lot of references passed around. It feels heavy. Let us say i changed the signature of the interface method to:
4
4009
by: MicroMoth | last post by:
Hi, I'm trying to write a update method, in which when the user clicks the update button the update method is passed 10 form fields. Then a update SQL is run to update the database. My question is whats the best way to pass large numbers of parameters into a method. Ten seems a large number to be passing into and out of a method. Stephen
3
1292
by: tshad | last post by:
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
4
2809
by: Deckarep | last post by:
Hello fellow C# programmers, This question is more about general practice and convention so here goes: I got into a discussion with a co-worker who insisted that as a general practice all objects should be passed by reference using the ref keyword generally speaking because as the writer of code you are conveying your intentions that an Object should/can be modified by your function.
7
3361
by: amygdala | last post by:
Hi all, I'm starting this new project in which I'ld like to implement sort of a design pattern I have seen being used in the CodeIgniter framework. Basically, the site will examine the URI and based on the segments of the URI it will fire up some controller class, for instance, say I have an inbox in which end-users can view messages they got from other users, they'ld start at:
0
8505
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8948
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8851
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8701
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5725
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2845
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2097
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1842
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.