views:

112

answers:

2

Hi,

I'm exploring all the options to persist user settings. The artilce in the url http://stackoverflow.com/questions/803245/user-specific-settings-files-for-a-windows-form-application-local-xml-file-or-da convinced me to store the settings into a db as my application is a standalone communicating with a DB. Is there any provider class like RegistrySettingsProvider to persist the data into database.

A: 

I afraid no because your use setting is very application specific and hence there is no general to do the persistence.

You might want to consider one of the following two approaches:

  1. Serialize your user setting class as a string, and store that string as a blob text column in one of your table.
  2. Create a table schema that maps to your user setting, and persist the setting according to each column.

I would prefer the first approach because of its flexibility.

Ngu Soon Hui
Both the approaches make sense to me. I'll try out. Thanks for the info.
poornima
A: 

No - there isn't anything directly comparable. I'd look at the user settings as just another kind of data to store in the database. Use the same methods to store the user settings as you do the rest of the application's data.

I recommend NHibernate for your data layer. Just set up a mapping file and the database table and let NHibernate handle persisting your data to the database. Use that for all your database storage throughout the app and see how little database code you need to write.

Brian Frantz
Thanks for the suggestion. NHibernate is new to me. I'll explore it nevertheless...
poornima