Reputation: 301
What it best location to store various configuration settings of a web site modules.
Creating class (that inherit ConfigurationSection) that map the settings in web.config file?
Or creating some DAL and BLL clases that work with database?
Upvotes: 10
Views: 4764
Reputation: 5414
I've used a simple heuristic to categorize each configuration variable into one of four categories:
Upvotes: 9
Reputation: 137188
To actually answer the question:
Basic information is going to have to be stored locally in web.config (connection strings etc.)
Beyond that other information could be stored in either location.
Having it in the database means that it's easier to write admin pages to control the information rather than editing the web.config file directly.
How often are things going to change? If set up is a one-off thing then having admin pages would be overkill, but if there's ongoing changes (adding new users, categories etc.) then they might be a good idea.
Also with data in the database you can perform remote administration on the system
So, without more information on your application I can't make a recommendation.
Upvotes: 3
Reputation: 37104
Build a configuration section. It is pretty straight forward and suits your needs.
Upvotes: 0
Reputation: 3228
Storing the configuration settings in the Web.config will have the effect that if you modify the web.config file, your application will be restarted and the new settings will have immediate effect. If you are running the application on multiple machines, you however will need to update each machine.
If you store the configuration settings in the database, you will need to either restart your web application manually or have a function (such as an admin page/site) to allow the application to re-read the settings.
Upvotes: 5
Reputation: 7941
In most times, you have separate settings for each module on each page. Thus, you have to save them in database.
Upvotes: 0