I have several key value pairs or mapping value, like
Eg: Liquid Manufacturing -> Processing+Batching+Filling+Sealing
There are several such key value pairs. These values might change frequently.
Whats the best practice? Can I save them to XML based config files? or database?
Can I have them in a config file and read it into a dictionary and use it in my application?
Thank you for your inputs.
“When will they change? Can the user change them or is it changed when the application is installed? Is the setting per user or per application? Is the setting valid only for one machine or does the same setting apply to clients on several machines?”
User cannot change them. Setting applies to entire application, all machines.
I prefer to use resource files for these kinds of things. They are still text-based files that can be changed on-the-fly without impacting the site in a global sense. Sometimes I load them into variables at the Application level in the global.asax, other times I get them as needed.
http://kumarnitesh.wordpress.com/2008/04/16/how-to-use-resource-file-in-c/
http://msdn.microsoft.com/en-us/library/ekyft91f(v=VS.100).aspx
http://msdn.microsoft.com/en-us/library/1ztca10y(v=VS.85).aspx
EDIT: A reason I choose not to put these sorts of things in the web.config is that the web.config can grow large pretty quickly in an application of any size. With resource files, the settings can be split apart into groupings of your choosing so the updating of one particular batch of settings can’t accidentally overwrite or harm any settings for the other areas. I still use web.config for global application settings, but for other settings that might be specific to a page or particular application piece, I keep those sequestered.