Storing settings like VS.NET (Tools...Options)

Administrator

VB.NET Forum Admin
Joined
Jun 3, 2004
Messages
1,462
Programming Experience
10+
If you were writing a program that stored settings like shown in VS.NET, i.e. lots of areas, lots of settings, how would you store your settings, what format would you use, how would you design this type of settings management system?
 
I use either a database (usually a Table in an Access database) or an xml file

if the app I'm making already has an Access database that it uses then I simply include 1 more table for all the settings

if the app does not use a database, or it uses multiple databases (not the same one on load) then I use an xml file

this decision also depends on the client and how flexible they'll let me be, if they're uptight about their data then I use a seperate xml file and I include code to check if the xml file exists in which if it doesn't then I make one filled with default settings when the app loads and use that
 
I think XML is the way to go, I'm actually using a DataTable within a DataSet to allow for intellisense. I am actually storing the settings (for this scenario) in the database associated to the users ID, storing the information as binary (compression and converted to byte array). The fun part of what I've done was also embed this into the My namespace. So I have My.AppName.Settings.SettingName. Has the same methods as My.Settings such as Load, Save, Reload, Reset. Was a little bit painful and some work, but it sure makes it nice to use when building the app.

Just seeing what others are using to store complex settings/preferences/options areas. Sharing ideas.
 
Visual Studio 2005 Express store such settings in registry, but encourage use of My.Settings (xml file based) for development. This may be a shift of operations from .Net 1 to .Net 2. My.Settings object is new with .Net 2, and I think it is easier to use/manage than the simplest similar option for .Net 1 which was the registry-based SaveSetting/GetSetting methods.
 
Well, if I could figure out how to "redirect" My.Settings to save in my database and not the local file system in an "undisclosed" location (well, we know where...) I would use it more. However, a change of the AssemblyFileVersion I think it is causes settings to get reset if I recall, I just don't trust it!
 
Back
Top