views:

58

answers:

3

Hi,

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 bit 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

+1  A: 

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.

Adam
That was I was thinking aswell. it "should" be in a configuration file, but because they are editable, I find it so dirty to put them in there. Normally I create custom config files for parameters, but only if the shouldn't be changed but once in a while.
Nealv
Make your life easy and put it in the database, it's a design decision that will have little impact or repercussion in the long run - allowing you to put your design time towards other aspects.
Adam
I find it strange that there is no real solution for this, I have thaught about it several times. Maybe I will create a small framework that associates keys and values in a single db table with authorization etc.I will put my head to it soon, to make a good analysis :DThanks everyone
Nealv
+6  A: 

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!)

cRichter
A resx would be difficult to edit post-build compared to config files or databases.
Adam
True. at least you can have them as external files and not inside the dll itself,... but its not the easiest to edit. true.
cRichter
+2  A: 

I would say in a database table is best.

As this data will 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.

Webicus