VolleyBall Player
VolleyBall Player

Reputation: 710

Store app settings in Database

We have lot appSettings in our asp.net application. Is it a good idea to move them to database. I know one advantage is it is easy to maintain and do administrative activities. I need to know if someone has faced any issues.

Upvotes: 3

Views: 3137

Answers (5)

Simon Halsey
Simon Halsey

Reputation: 5480

Asp.net has a mechanism for implementing a custom provider for config. I've looked into this for a scenario where multiple servers need the same config, so having a shared config would be good. there was very very little documentation on it.

You also face the issue that web.config files are watched, so any changes prompt the app to restart. With a DB you'd need an alternate mechanism for this, or work around it or just do without.

Far simpler is to define a custom config section.

Simon

Upvotes: 0

Schroedingers Cat
Schroedingers Cat

Reputation: 3129

There are a number of things you can do to reduce the number of app settings, and make them easier to maintain. Each of them has its own positive and negative. Moving them to a db is one, which can help to improve the maintainability ( and can allow you to build a front end to monitor and tweak them without requiring a recycle ). Alternatively, you might want to group some of them into custom sections, if they are related, and so make them better documented, and not just key value pairs.

If they go in the db, you need to consider caching them, and how you should manage the cache.

There is no general answer. It will depend on your situation.

Upvotes: 1

detaylor
detaylor

Reputation: 7280

I would expect that doing this would give you a performance hit as appSettings are loaded into memory what the application is loaded and then reloaded if the web.config is updated. If you stored them in a database then you would need to hit the database everytime.

I couldn't give an indication of the level of performance difference so it may or may not be an issue.

Upvotes: 0

Kynth
Kynth

Reputation: 2607

Using an app.config / web.config / database / cache / custom solution to store configuration values are all valid options.

Which method you choose really does depend on what's right for you, your team and your application in your situation.

Upvotes: 0

Illuminati
Illuminati

Reputation: 4619

We do not have any appsettings in the config but maintains a seperate DB table as the amount of configuration is huge. There is no issue with that. Of course we have to use some caching to prevent too much of queries related to config information.

Upvotes: 1

Related Questions