3

I have stored all my application (key-value pair) settings in the app.config so far in my Windows Forms application. I'd like to change it, because

  • I should store settings by user (NOT win user, but my app user)
  • there are some confidential settings that must be stored
  • I have several clients, that connects to the same db, so one app user can log in from any client
  • there can be problems writing to config files, cause app folder fro a given windows user can be read-only

Using config for this purpose is very comfortable, but I can not work with it on because of these problems.

My question is, if there is an out-of-the box or well tested, widely used library/class/way that can read/write key-value pair settings from a database?

Tom
  • 3,899
  • 22
  • 78
  • 137

2 Answers2

4

If I understand your problem correctly, you want to store per-user configuration information for your application. You might want to try ASP.NET Profile Properties (available since 2.0). The functionality dovetails nicely with the Role Provider, which is commonly used for security.

http://msdn.microsoft.com/en-us/library/ie/2y3fs9xs.aspx.

Peter
  • 634
  • 7
  • 17
1

You can look out the Cinchoo Framework. You can do it using 'Configuration Storage Plug-in', which is the extension of Cinchoo configuration framework. Using it you can write your own custom configuration piug-in and use them in your application. Hope it helps.

Cinchoo
  • 6,088
  • 2
  • 19
  • 34
  • It looks very promising! The only thing is not clear for me at first sight if it possible to read/store settings by my app users out of the box. By separate sections in config or any other way. – Tom Jun 26 '12 at 09:51
  • Of if I'd like to store settings in xml, not in db, is it possible to configure config file name programatically. Then files could be used by users. – Tom Jun 26 '12 at 10:04
  • Answer to second question. yes, you can using Cinchoo framework. Please visit http://cinchoo.com/2012/06/26/cinchoo-configuration-framework-part-23/ – Cinchoo Jun 26 '12 at 18:32
  • Answer to your first question. Yes, you can. But it may pose serious issues while writing config settings to same file by different apps at the same time. To avoid, have them seperate config file. [ChoConfigurationSection("applicationSettings1", ConfigFilePath="C:\test1.xml")] public class ApplicationSettings1 : ChoConfigurableObject { } [ChoConfigurationSection("applicationSettings2", ConfigFilePath="C:\test2.xml")] public class ApplicationSettings2 : ChoConfigurableObject { } Hope this helps. – Cinchoo Jun 26 '12 at 18:41