I am struggling with how to persist preferences/settings/configurations that are read but also updated by my C# application. My configurations can be
- individual ints, strings, byte[] that represent connection strings, directory names, file names,...
collections of strings or other value types.
class object instances that represent a group of mostly value types.
-> Such settings are accessed in different, sometimes unrelated classes.
I am currently pondering what you think is best practice, given the following bullet points:
A self-written key/value store. Internally the key/values are stored in a hashtable and the hashtable is serialized/deserialized for persistence.
Entity Framework: I have access to the MS entity framework and run MySQL server instances.
Text file / XML file
Any other/better ideas?
Exclusion:
I do not want to store any settings in Settings.settings, App.config, or the like
I do not want to use the registry
I do not want to store settings in any obscure roaming directory structures or other hidden directories. The settings should either be stored in a dedicated database/table or in the application executable folder or sub-folder.
Questions:
- I am not sure whether to store all configuration objects in one and the same entity or whether I should setup several such entities to store groups of configurations?
- what is the best way to persist such lightweight objects that function as settings/configuration and later load and access those?