views:

412

answers:

4

Hello 1) I use Visual Studio 2008 (C#)

2) I want my desktop application to "remember" certain settings (preferences) for every user individually.

3) The application would use its own database of users (logins + passwords), so they have nothing to do with Windows accounts.

How can I accomplish that? Trying to find an answer

4) I've found the "Using Alternate Sets of Settings" subject on MSDN => http://msdn.microsoft.com/en-us/library/aa730869%28VS.80%29.aspx - but

5) it suggests that even these alternative settings need to be added in design time. That's a bit of a problem, because:

6) I don't know in advance, how many users would be in the database - and I want the "main user" (admin) to have an option of adding more accounts any time he wants.

So 7) how do I accomplish that?

So far I thought about: 8) using isolated storage files? (but they, too, are user-scoped in the sense of referring to Windows accounts)

9) deriving my own class from ApplicationSettingsBase class and supplying it with a SaveAs() method (which it lacks by default)?

Thanks for any answers / suggestions. If my problem is not quite clear, I'm happy to clarify

+1  A: 

If you have a database that stores users and passwords, why not store the application settings there as well? I'm assuming you're using SQL Server (Express or commercial)

All "Settings" are in .NET are key, value pairs, and I don't see why you couldn't accomplish this exact same functionality with a name value pair in the database.

I've found that the "Settings" and Configuration management tools are confusing and tricky to use, so if you have a database with users in it already, you might as well leverage your existing infrastructure.

MedicineMan
+1  A: 

You could use a SQLite database to hold all the data. (See System.Data.SQLite)

Druid
+1  A: 

You should think about using the ASP.NET Membership provider. It allows for per-user personalization settings as well as 'all user' settings.

It was built for web sites, but you can configure it for use in a desktop application pretty easily. Also, there is a whole API that is already written for it.

Matt Brunell
A: 

Where to able to resolve this? I am trying to accomplist something similar. Can you please share your core design?

Thanks, Whiz

Whiz
Well I didn't really ponder over this very much... I took MedicineMan's practical advice and simply put the preferences in the SQL database.
Vibo