PC Review


Reply
Thread Tools Rate Thread

Application Settings Best Way Question

 
 
Icarus
Guest
Posts: n/a
 
      12th Feb 2008
I'm working on the design stage of a very flexible and parametrized
application. It'll hold about 50 to 60 diferent application settings.
Admin users sholud be able to change any application setting to set a new
application behavior.
I won't use app.config since application will be distributed using click
once and settings could change.
Settings type are diferent each other, I mean, It could have strings,
numeric or image settings.

I'll store settings on a Settings table inside a SQL Server Database.

I've been asking about the best way to do this and allways get this two
options:

1.- Map each setting to a column in the settings table, so I'll have as much
colums as application settings. Then create a class in which every property
holds an application setting. Each time I need to read an app setting I'll
read a class property. That class should contains a GetSettings methid to
refresh settings value.

2.- Define a IdSetting, SettingName, SettingValue table that contains each
application setting. A new query is completed every time I need to read a
setting value.

Can anyone point me to the right direction or share his experience doing
application settings without confi files?

T.I.A.

SG


 
Reply With Quote
 
 
 
 
Mr. Arnold
Guest
Posts: n/a
 
      13th Feb 2008

"Icarus" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> I'm working on the design stage of a very flexible and parametrized
> application. It'll hold about 50 to 60 diferent application settings.
> Admin users sholud be able to change any application setting to set a new
> application behavior.
> I won't use app.config since application will be distributed using click
> once and settings could change.


So you don't deploy the app.config in subsequent deployments.

> Settings type are diferent each other, I mean, It could have strings,
> numeric or image settings.


So, you have one application that's being used by multiple users?

>
> I'll store settings on a Settings table inside a SQL Server Database.
>
> I've been asking about the best way to do this and allways get this two
> options:
>
> 1.- Map each setting to a column in the settings table, so I'll have as
> much colums as application settings. Then create a class in which every
> property holds an application setting. Each time I need to read an app
> setting I'll read a class property. That class should contains a
> GetSettings methid to refresh settings value.
>
> 2.- Define a IdSetting, SettingName, SettingValue table that contains each
> application setting. A new query is completed every time I need to read a
> setting value.
>
> Can anyone point me to the right direction or share his experience doing
> application settings without confi files?


Is this the only use for the SQL Server table is this app setting and
nothing else in the application is using SQL Server?

What version of the .Net framework is being used?

 
Reply With Quote
 
RobinS
Guest
Posts: n/a
 
      13th Feb 2008
I'm doing this using an XML file that is read into (and saved from) a
Dictionary<string, string>. You could as easily store it in SQLServer; that
would be overkill for us. We have about 50 settings that we are storing.

I created a class that I called ConfigManager that handles the updates,
deletes, etc. This is a static class that is in its own project, and is
called by the rest of the application, with methods like GetValue, Update
(which saves the dictionary to disk), Delete (which saves the dictionary),
etc.

Upon application startup, it checks to see if the file has been created, and
if not, it creates it. We have a bunch of hardcoded defaults, and then it
reads in whatever else is in the file, into the dictionary.

The XML file is being stored in a folder named by our company name, under
Environment.SpecialFolder.LocalApplicationData. It is different for every
user.

We deploy our application via ClickOnce. Since this file is not part of the
deployment, and not in the deployment folders, it is retained throughout the
updates. So if you want to update the file, you have to write code to do
that in the application. I haven't had to do that yet.

We don't use the application settings because of the issue with the updates,
and because we wanted finer control.

RobinS.
GoldMail, Inc.
----------------------------
"Icarus" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> I'm working on the design stage of a very flexible and parametrized
> application. It'll hold about 50 to 60 diferent application settings.
> Admin users sholud be able to change any application setting to set a new
> application behavior.
> I won't use app.config since application will be distributed using click
> once and settings could change.
> Settings type are diferent each other, I mean, It could have strings,
> numeric or image settings.
>
> I'll store settings on a Settings table inside a SQL Server Database.
>
> I've been asking about the best way to do this and allways get this two
> options:
>
> 1.- Map each setting to a column in the settings table, so I'll have as
> much colums as application settings. Then create a class in which every
> property holds an application setting. Each time I need to read an app
> setting I'll read a class property. That class should contains a
> GetSettings methid to refresh settings value.
>
> 2.- Define a IdSetting, SettingName, SettingValue table that contains each
> application setting. A new query is completed every time I need to read a
> setting value.
>
> Can anyone point me to the right direction or share his experience doing
> application settings without confi files?
>
> T.I.A.
>
> SG
>


 
Reply With Quote
 
Icarus
Guest
Posts: n/a
 
      13th Feb 2008
Thanks for the info RobinS.

"RobinS" <(E-Mail Removed)> escribió en el mensaje
news:-(E-Mail Removed)...
> I'm doing this using an XML file that is read into (and saved from) a
> Dictionary<string, string>. You could as easily store it in SQLServer;
> that would be overkill for us. We have about 50 settings that we are
> storing.
>
> I created a class that I called ConfigManager that handles the updates,
> deletes, etc. This is a static class that is in its own project, and is
> called by the rest of the application, with methods like GetValue, Update
> (which saves the dictionary to disk), Delete (which saves the dictionary),
> etc.
>
> Upon application startup, it checks to see if the file has been created,
> and if not, it creates it. We have a bunch of hardcoded defaults, and then
> it reads in whatever else is in the file, into the dictionary.
>
> The XML file is being stored in a folder named by our company name, under
> Environment.SpecialFolder.LocalApplicationData. It is different for every
> user.
>
> We deploy our application via ClickOnce. Since this file is not part of
> the deployment, and not in the deployment folders, it is retained
> throughout the updates. So if you want to update the file, you have to
> write code to do that in the application. I haven't had to do that yet.
>
> We don't use the application settings because of the issue with the
> updates, and because we wanted finer control.
>
> RobinS.
> GoldMail, Inc.
> ----------------------------
> "Icarus" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> I'm working on the design stage of a very flexible and parametrized
>> application. It'll hold about 50 to 60 diferent application settings.
>> Admin users sholud be able to change any application setting to set a new
>> application behavior.
>> I won't use app.config since application will be distributed using click
>> once and settings could change.
>> Settings type are diferent each other, I mean, It could have strings,
>> numeric or image settings.
>>
>> I'll store settings on a Settings table inside a SQL Server Database.
>>
>> I've been asking about the best way to do this and allways get this two
>> options:
>>
>> 1.- Map each setting to a column in the settings table, so I'll have as
>> much colums as application settings. Then create a class in which every
>> property holds an application setting. Each time I need to read an app
>> setting I'll read a class property. That class should contains a
>> GetSettings methid to refresh settings value.
>>
>> 2.- Define a IdSetting, SettingName, SettingValue table that contains
>> each application setting. A new query is completed every time I need to
>> read a setting value.
>>
>> Can anyone point me to the right direction or share his experience doing
>> application settings without confi files?
>>
>> T.I.A.
>>
>> SG
>>

>



 
Reply With Quote
 
Icarus
Guest
Posts: n/a
 
      13th Feb 2008

"Mr. Arnold" <MR. (E-Mail Removed)> escribió en el mensaje
news:(E-Mail Removed)...
>
> "Icarus" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> I'm working on the design stage of a very flexible and parametrized
>> application. It'll hold about 50 to 60 diferent application settings.
>> Admin users sholud be able to change any application setting to set a new
>> application behavior.
>> I won't use app.config since application will be distributed using click
>> once and settings could change.

>
> So you don't deploy the app.config in subsequent deployments.
>
>> Settings type are diferent each other, I mean, It could have strings,
>> numeric or image settings.

>
> So, you have one application that's being used by multiple users?

Yes

>
>>
>> I'll store settings on a Settings table inside a SQL Server Database.
>>
>> I've been asking about the best way to do this and allways get this two
>> options:
>>
>> 1.- Map each setting to a column in the settings table, so I'll have as
>> much colums as application settings. Then create a class in which every
>> property holds an application setting. Each time I need to read an app
>> setting I'll read a class property. That class should contains a
>> GetSettings methid to refresh settings value.
>>
>> 2.- Define a IdSetting, SettingName, SettingValue table that contains
>> each application setting. A new query is completed every time I need to
>> read a setting value.
>>
>> Can anyone point me to the right direction or share his experience doing
>> application settings without confi files?

>
> Is this the only use for the SQL Server table is this app setting and
> nothing else in the application is using SQL Server?
>

The app uses SQL Server for data storage.

> What version of the .Net framework is being used?
>

2.0


 
Reply With Quote
 
Mr. Arnold
Guest
Posts: n/a
 
      14th Feb 2008

"Icarus" <(E-Mail Removed)> wrote in message
news:%23gRmg$(E-Mail Removed)...
>
> "Mr. Arnold" <MR. (E-Mail Removed)> escribió en el mensaje
> news:(E-Mail Removed)...
>>
>> "Icarus" <(E-Mail Removed)> wrote in message
>> news:%(E-Mail Removed)...
>>> I'm working on the design stage of a very flexible and parametrized
>>> application. It'll hold about 50 to 60 diferent application settings.
>>> Admin users sholud be able to change any application setting to set a
>>> new application behavior.
>>> I won't use app.config since application will be distributed using click
>>> once and settings could change.

>>
>> So you don't deploy the app.config in subsequent deployments.
>>
>>> Settings type are diferent each other, I mean, It could have strings,
>>> numeric or image settings.

>>
>> So, you have one application that's being used by multiple users?

> Yes
>
>>
>>>
>>> I'll store settings on a Settings table inside a SQL Server Database.
>>>
>>> I've been asking about the best way to do this and allways get this two
>>> options:
>>>
>>> 1.- Map each setting to a column in the settings table, so I'll have as
>>> much colums as application settings. Then create a class in which every
>>> property holds an application setting. Each time I need to read an app
>>> setting I'll read a class property. That class should contains a
>>> GetSettings methid to refresh settings value.
>>>
>>> 2.- Define a IdSetting, SettingName, SettingValue table that contains
>>> each application setting. A new query is completed every time I need to
>>> read a setting value.
>>>
>>> Can anyone point me to the right direction or share his experience doing
>>> application settings without confi files?

>>
>> Is this the only use for the SQL Server table is this app setting and
>> nothing else in the application is using SQL Server?
>>

> The app uses SQL Server for data storage.
>
>> What version of the .Net framework is being used?
>>

> 2.0


There is a demo in the .Net 2.0 Application Block Demo, that you can
download, about using the app.config that holds configuration information
which is pulled into your application as an object. You you can access that
object's config data with ease in your application. The app.config demo
project also shows one how to use a SystemFileWatch to detect any changes in
the programname.app.config during run time to pull the new configuration
into the program and use them.

It may be something you'll want to look at, as I use it all the time with
Windows service and Console applications, where the programname.app.config
will have dynamic data in the config used at runtime.



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Application Settings user settings storage directory Chris Crowther MBCS Microsoft Dot NET 5 9th Apr 2008 10:02 AM
Settings stored in ...\local settings\application data\... deleted Marco Windows XP General 0 28th Jan 2008 04:36 PM
My.Settings Application and User Scope Settings =?Utf-8?B?TUFUVA==?= Microsoft Dot NET Framework Forms 1 28th Mar 2007 11:14 PM
Dynamic settings entries with Application Settings. Sin Jeong-hun Microsoft C# .NET 2 1st Feb 2007 04:40 AM
ConfigurationManager, user settings and application settings Mark Ingram Microsoft Dot NET Framework 3 17th Jan 2006 05:40 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:10 PM.