views:

52

answers:

1

Hello everybody,

There is a lot of configurable information for a web-site:

  • UI messages
  • Number of records used in pagination & other UI parameters
  • Cache duration for web-pages & timeouts
  • Route maps & site structure
  • ...

There are many approaches to store all this information also:

  • AppSettings (web.config)
  • Custom sections (web.config)
  • External xml/text files referred from web.config
  • Internal static class(es) of constants
  • Database table(s)
  • ...

What approaches do you usually choose for your tasks & what approaches do you find unsuitable?

Thank you in advance!

+2  A: 

these are all very subjective and depend on the type of site you have, but here are my two cents:

UI messages - if multi-lingual, store them in resource files

Number of records used in pagination & other UI parameters - I like to make this selectable by the users, if using jquery to do this plugins such as tablesorter and tablesorter.pager make it easy

Cache duration for web-pages & timeouts - really depends on how time sensitive your data is. If content is updated frequently, you may not want to cache it for long. But if there is a lot of code to retrieve and organize the data, you may want to cache it for longer to improve performance.

Route maps & site structure - really dependent on what type of site you have and whether it will benefit the users

AppSettings (web.config) - good for constants and items that won't change often, or are specific to that installation, such as base url, webservice url, google api keys, etc

Custom sections (web.config) - can be good for settings that don't conform well to the dictionary format, one key to one value.

External xml/text files referred from web.config - I use this as a last resort, might nust be preference, but I hate using file i/o on the site.

Internal static class(es) of constants - Good approach to store settings that are loaded from the db, to avoid a db hit everytime you need the values

Database table(s) - when using db tables for settings, I prefer to load them into a static class and refresh it periodically, to avoid having to hit the db everytime I need the data

derek
ok :) I'll ask some detailed questions separately
Andrew Florko
wrt to 2 last points, Cache with callback option would be better(than static)?
PRR