Question

I will (hopefully) be taking on a large project to migrate an enterprise Visual FoxPro application to C# 3.0 on .NET 3.5. I know that this application has a huge number of settings that have an impact on everything from multi-user/multi-site configurations to report properties. There's at least 150 different settings that are currently globally scoped.

The settings are currently just stored as bits in the application's database, which prevents them from being changed at the user level, since all instances share the same db.

My question is, do you know of any way to handle the storage of these settings that would allow them to be changed per user, without sacrificing performance? It would also need to be stored in a way that allows the values to be changed while the application is running. Any ideas would be appreciated.

Was it helpful?

Solution

The standard Settings.Settings file I believe offers you this functionality, including application or user scoped variables. Although I'm not 100% sure if changes are picked up without restarting the application.

See here for more info: MSDN:Using Settings in C#

OTHER TIPS

If you want to go "enterprise", you can try having a setting definitions table, paired with a user settings table.

The setting definitions would have the PK defined by a domain column (for UI settings, connection settings, language settings and so on...), and a setting identifier. A third column would define the default/global value.

The user settings would have the PK set to setting definitions' PK + user id and a setting value column, varchar(x).

If the application is language aware, language id columns should be added to both tables.

Saving user changes to the user settings table should be trivial. Being notified when global settings change is a bit more complicated.

EDIT: one thing to keep in mind is to always fallback to some default: global setting / default language.

Add a User field to the table in the application's database that stores settings, and then add the current user as a parameter to all the read/write calls to this table.

You might have to work through logically for items that are data/application specific vs user specific. In VFP (foxpro), the tables and their respective primary keys are obviously the same, regardless of the user. Other things, such as default values may be customizable per individual user, accounts, access, abilities to add/edit/delete, etc.

HTH

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top