Where to store editable configuration parameters
I am building a small cms system in MVC.NET, and I have some editable variables to store. Footer information, website title etc. These are Global variables so they should only be declared once. These should be editable in the cms.
Where could I store them ? Isn't it a bi开发者_Go百科t stupid to create a table for them, there they only would occupy 1 record per variable, and the variable keys should be fixed because they are used in the code.
Thanks in advance for every answer.
Grtz
Why not making it in a nice config file?
If it is just text, maybe you would consider it to store it in Resx resource files, as they are Culture enabled (Multilanguage!)
I would say in a database table is best.
As this data will be editable there is a good chance you will need lots of meta information as well, locked for edit, versions, last changed date. It is easy to add an SQL cache dependency if you use MS-SQL. It will be part of the CMS data and can be backed up in one place. Its usually safer than editing config file.
A table would be fine, just load it once and cache what you load to avoid going to the database many times.
Alternatively, you could use a configuration file.
精彩评论