views:

87

answers:

3

Some projects have properties have miscellaneous settings such as: "AllowPayments", "ShowSideBar", "SectionTitle". Really things that don't necessarily fit in to other objects.

How do you guys store these kinds of values? ApplicationSettings? Flat File? Database table?

How do you access them? Static object with properties? DB call?

Would either of these change if you were in a load balanced environment where you would have to synchronize the files across multiple servers?

Environment ASP.NET 2.0

+1  A: 

App.Config, or a custom xml configuration file and config service. Key value pair mappings keeps things very simple.

Chris
A: 

Since you didn't tell which environment you use: In .NET applications, I use the ApplicationSettings system from Visual Studio. This way you can configure the settings with default values in the designer, and a strongly-typed class to access the values is generated. I usually add a second ApplicationSettings element with the name Persistent in addition to the default Settings, with anything the user configures to go in the Settings object and anything I just save (i.e. window position) to the Persistent object.

This goes for desktop applications.

OregonGhost
+1  A: 

For me it depends on the context the setting is. If it relates to the data and the domain, i store in the database, if it relates the the application i store in the web.config.

mattlant