473,402 Members | 2,064 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Best way to maintain settings?

We have a .NET Win app that runs at 12 different cattle feeding lots. Each
lot runs an isolated instance of our app using its own SQL Server instance.

For overall settings specific to a feedlot, we're maintaining those values
right now in the database. But I'm not sure its the best way to do it. You
see, we have a table "tblFeedlot" with about 20 columns BUT then only one
record in the table.

I thought maybe the table should have just two columns "Name" and "Value" to
and have 20 records, but then the datatype would have to be varchar(100) I
suppose and we'd have to d alot of validating/converting. But maybe this is
the better way to go?

Or do you recommend another way? Would there be some sort of app.config
specific to each feedlot that we stored somewhere?

Thanks,
Ron
Aug 26 '06 #1
5 1379
Ron,

The app.config file is exactly what you should be doing. You can set
the values you need in the app.config file, and then read them easily.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ronald S. Cook" <rc***@westinis.comwrote in message
news:u8**************@TK2MSFTNGP05.phx.gbl...
We have a .NET Win app that runs at 12 different cattle feeding lots.
Each lot runs an isolated instance of our app using its own SQL Server
instance.

For overall settings specific to a feedlot, we're maintaining those values
right now in the database. But I'm not sure its the best way to do it.
You see, we have a table "tblFeedlot" with about 20 columns BUT then only
one record in the table.

I thought maybe the table should have just two columns "Name" and "Value"
to and have 20 records, but then the datatype would have to be
varchar(100) I suppose and we'd have to d alot of validating/converting.
But maybe this is the better way to go?

Or do you recommend another way? Would there be some sort of app.config
specific to each feedlot that we stored somewhere?

Thanks,
Ron

Aug 26 '06 #2
But the same app is installed at 12 sites and each site's specific values
must be retrieved and used. I wouldn't think we'd maintain a separate
app.config for each feedlot. Or should we?

Thanks,
Ron
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:%2****************@TK2MSFTNGP06.phx.gbl...
Ron,

The app.config file is exactly what you should be doing. You can set
the values you need in the app.config file, and then read them easily.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ronald S. Cook" <rc***@westinis.comwrote in message
news:u8**************@TK2MSFTNGP05.phx.gbl...
>We have a .NET Win app that runs at 12 different cattle feeding lots.
Each lot runs an isolated instance of our app using its own SQL Server
instance.

For overall settings specific to a feedlot, we're maintaining those
values right now in the database. But I'm not sure its the best way to
do it. You see, we have a table "tblFeedlot" with about 20 columns BUT
then only one record in the table.

I thought maybe the table should have just two columns "Name" and "Value"
to and have 20 records, but then the datatype would have to be
varchar(100) I suppose and we'd have to d alot of validating/converting.
But maybe this is the better way to go?

Or do you recommend another way? Would there be some sort of app.config
specific to each feedlot that we stored somewhere?

Thanks,
Ron


Aug 26 '06 #3
Ronald,

Yes, you would have a separate app.config file for each feed lot.
That's the whole point, this is where you would differentiate in the
settings. Basically, your configuration file would look like this:

<configuration>
<appSettings>
<add key="SomeKey" value="SomeValueForFeedLot1" />
</appSettings>
</configuration>

At another feed lot, you would have:

<configuration>
<appSettings>
<add key="SomeKey" value="SomeValueForFeedLot2" />
</appSettings>
</configuration>

And so on. Granted, you could write a configuration section handler,
but for something like this, this would do just fine, I think.

Then, to access these values in code:

// Get the "SomeKey" value:
string someKeyValue = ConfigurationManager.AppSettings["SomeKey"];

This will require a reference to System.Configuration.dll and this .NET
2.0-specific. In .NET 1.1 and before, you can do the same thing in the
app.config file but use this:

// Get the "SomeKey" value:
string someKeyValue = ConfigurationSettings.AppSettings["SomeKey"];
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Ronald S. Cook" <rc***@westinis.comwrote in message
news:uu**************@TK2MSFTNGP06.phx.gbl...
But the same app is installed at 12 sites and each site's specific values
must be retrieved and used. I wouldn't think we'd maintain a separate
app.config for each feedlot. Or should we?

Thanks,
Ron
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote
in message news:%2****************@TK2MSFTNGP06.phx.gbl...
>Ron,

The app.config file is exactly what you should be doing. You can set
the values you need in the app.config file, and then read them easily.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ronald S. Cook" <rc***@westinis.comwrote in message
news:u8**************@TK2MSFTNGP05.phx.gbl...
>>We have a .NET Win app that runs at 12 different cattle feeding lots.
Each lot runs an isolated instance of our app using its own SQL Server
instance.

For overall settings specific to a feedlot, we're maintaining those
values right now in the database. But I'm not sure its the best way to
do it. You see, we have a table "tblFeedlot" with about 20 columns BUT
then only one record in the table.

I thought maybe the table should have just two columns "Name" and
"Value" to and have 20 records, but then the datatype would have to be
varchar(100) I suppose and we'd have to d alot of validating/converting.
But maybe this is the better way to go?

Or do you recommend another way? Would there be some sort of app.config
specific to each feedlot that we stored somewhere?

Thanks,
Ron



Aug 27 '06 #4
Thanks for the advice, Nicholas. I should have mentioned, though, that
through the application, the values will need to be updated. I think this
forces the data back to the database.

Assuming you agree, do you like one record with many columns, or just
key/value columns and many records in a table.

Thanks for the responses,
Ron
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:es**************@TK2MSFTNGP06.phx.gbl...
Ronald,

Yes, you would have a separate app.config file for each feed lot.
That's the whole point, this is where you would differentiate in the
settings. Basically, your configuration file would look like this:

<configuration>
<appSettings>
<add key="SomeKey" value="SomeValueForFeedLot1" />
</appSettings>
</configuration>

At another feed lot, you would have:

<configuration>
<appSettings>
<add key="SomeKey" value="SomeValueForFeedLot2" />
</appSettings>
</configuration>

And so on. Granted, you could write a configuration section handler,
but for something like this, this would do just fine, I think.

Then, to access these values in code:

// Get the "SomeKey" value:
string someKeyValue = ConfigurationManager.AppSettings["SomeKey"];

This will require a reference to System.Configuration.dll and this .NET
2.0-specific. In .NET 1.1 and before, you can do the same thing in the
app.config file but use this:

// Get the "SomeKey" value:
string someKeyValue = ConfigurationSettings.AppSettings["SomeKey"];
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Ronald S. Cook" <rc***@westinis.comwrote in message
news:uu**************@TK2MSFTNGP06.phx.gbl...
>But the same app is installed at 12 sites and each site's specific values
must be retrieved and used. I wouldn't think we'd maintain a separate
app.config for each feedlot. Or should we?

Thanks,
Ron
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote
in message news:%2****************@TK2MSFTNGP06.phx.gbl...
>>Ron,

The app.config file is exactly what you should be doing. You can set
the values you need in the app.config file, and then read them easily.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ronald S. Cook" <rc***@westinis.comwrote in message
news:u8**************@TK2MSFTNGP05.phx.gbl...
We have a .NET Win app that runs at 12 different cattle feeding lots.
Each lot runs an isolated instance of our app using its own SQL Server
instance.

For overall settings specific to a feedlot, we're maintaining those
values right now in the database. But I'm not sure its the best way to
do it. You see, we have a table "tblFeedlot" with about 20 columns BUT
then only one record in the table.

I thought maybe the table should have just two columns "Name" and
"Value" to and have 20 records, but then the datatype would have to be
varchar(100) I suppose and we'd have to d alot of
validating/converting. But maybe this is the better way to go?

Or do you recommend another way? Would there be some sort of
app.config specific to each feedlot that we stored somewhere?

Thanks,
Ron



Aug 27 '06 #5
Ronald,

I don't necessarily agree. It depends on how often those values are
updated.

If the values are ones that are not user-controlled, meaning that you
set them and change them when necessary, then the database is the wrong
place for this, it should be in the app.config file.

If the values are user-controlled, and changed with any sort of
frequency, then yes, the database is the better place. I would most likely
have a table with typed columns for specific values. It's easier to perform
other operations in the database than if you had a table with a key/value
pair.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ronald S. Cook" <rc***@westinis.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Thanks for the advice, Nicholas. I should have mentioned, though, that
through the application, the values will need to be updated. I think this
forces the data back to the database.

Assuming you agree, do you like one record with many columns, or just
key/value columns and many records in a table.

Thanks for the responses,
Ron
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote
in message news:es**************@TK2MSFTNGP06.phx.gbl...
>Ronald,

Yes, you would have a separate app.config file for each feed lot.
That's the whole point, this is where you would differentiate in the
settings. Basically, your configuration file would look like this:

<configuration>
<appSettings>
<add key="SomeKey" value="SomeValueForFeedLot1" />
</appSettings>
</configuration>

At another feed lot, you would have:

<configuration>
<appSettings>
<add key="SomeKey" value="SomeValueForFeedLot2" />
</appSettings>
</configuration>

And so on. Granted, you could write a configuration section handler,
but for something like this, this would do just fine, I think.

Then, to access these values in code:

// Get the "SomeKey" value:
string someKeyValue = ConfigurationManager.AppSettings["SomeKey"];

This will require a reference to System.Configuration.dll and this
.NET 2.0-specific. In .NET 1.1 and before, you can do the same thing in
the app.config file but use this:

// Get the "SomeKey" value:
string someKeyValue = ConfigurationSettings.AppSettings["SomeKey"];
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Ronald S. Cook" <rc***@westinis.comwrote in message
news:uu**************@TK2MSFTNGP06.phx.gbl...
>>But the same app is installed at 12 sites and each site's specific
values must be retrieved and used. I wouldn't think we'd maintain a
separate app.config for each feedlot. Or should we?

Thanks,
Ron
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote
in message news:%2****************@TK2MSFTNGP06.phx.gbl...
Ron,

The app.config file is exactly what you should be doing. You can
set the values you need in the app.config file, and then read them
easily.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ronald S. Cook" <rc***@westinis.comwrote in message
news:u8**************@TK2MSFTNGP05.phx.gbl...
We have a .NET Win app that runs at 12 different cattle feeding lots.
Each lot runs an isolated instance of our app using its own SQL Server
instance.
>
For overall settings specific to a feedlot, we're maintaining those
values right now in the database. But I'm not sure its the best way
to do it. You see, we have a table "tblFeedlot" with about 20 columns
BUT then only one record in the table.
>
I thought maybe the table should have just two columns "Name" and
"Value" to and have 20 records, but then the datatype would have to be
varchar(100) I suppose and we'd have to d alot of
validating/converting. But maybe this is the better way to go?
>
Or do you recommend another way? Would there be some sort of
app.config specific to each feedlot that we stored somewhere?
>
Thanks,
Ron
>




Aug 27 '06 #6

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

Similar topics

5
by: Dennis C. Drumm | last post by:
Is there one place (local xml file, registry, etc.) that all user can read and write to?? I have some settings that applicable to all users, but when a restricted rights user start my...
4
by: Matt Jensen | last post by:
Howdy all Hopefully I can explain my problem straightforwardly. In it's simplest explanation, what I want to do is have a hyperlink that, when clicked, executes some client side JavaScript and...
3
by: Carlos | last post by:
Hello Forum, I would appreciate it if you could recommend settings to use auto-vacuum in my version 7.4 database. I am uploading several thousands records in the database at a rate of ~1 second...
4
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...
3
by: davepkz | last post by:
I have a basic question about managing user.config settings: In my C# app, I save the user's preferences to the config file. But each time I release a new build of the app, something in .NET...
6
by: John J. Hughes II | last post by:
I am creating a new windows service and will have a windows form for setting the runtime settings. In the past I have used the registry for this but since MS seems to think this is a bad thing I...
0
by: José Joye | last post by:
Hello, I'm trying to use the VS2005 Settings file so as to get strongly typed settings. I want the following: - Have all my application setting (with application scope) defined centrally in my...
2
by: dasomerville | last post by:
We have different settings for our development, stage and production environments. For example, our development environment connection strings point to development database instances, stage...
2
by: Johnny Jörgensen | last post by:
Can somebody explain hopw to store and restore settings values in .NET 2005? I read in MSDN that "The Application Settings feature of Windows Forms makes it easy to create, store, and maintain...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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,...
0
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...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.