views:

77

answers:

1

Just wondering what the best practise advice would be on the architecture for a settings class. We've a number of tables which will be used to populate the class, I'm guessing a Hashtable is the best way to go? It also would be nice to have a strongly typed collection available through the scope of the app in Intellisense.

e.g.

Settings.Car.Colour

I'm also wondering about the SQL dependancy classes in .NET - I'd like to implement this observer pattern- just wondering if anyone has any thoughts on whether its the best option - or should I roll my own solution. The added tables and settings within SQL server for this to work seem to limit this to a managed server.

Any other classes within the framework that I should look at?

A: 

I wouldn't use the SQL Dependency classes to determine when something changes in the settings in your database. It ties you too much to the specific database (although you could abstract it out, if you wanted).

Rather, I would have some sort of message notification sent to listeners that are interested when the changes to the database occur, and then have the listeners invalidate their cache.

Also, adding a strongly-typed collection is always advised. It could just forward calls to the hashtable/dictionary, but you want something you can bind to at compile time, as opposed to run time.

casperOne