Solution for storing a lot of web app configuration ?

H

hendry.johan

Hi,

I'm currently developing an HR system which involves storing a lot of
configurations per module, such as payroll module, absence/shift
module, training module, etc. total: around 100 configuration items.

Configurations here, ranging from a simple key to value pair, a key to
multiple values, and a key to several records of a / multiple values.
Let me give an example to clarify this:

* [Key to value] Percent of X tax to deduct from employee salary = 5%.

* [Key to multiple values] Limit (days) of employee taking a leave
between: 1 - 5.

* [Key to several records of a / multiple values]
a. Employee level entitled to one holiday per month: Manager,
Supervisor, Vice Manager.
b. Regulation on annual tax deduction: Manager -> 1%, Supervisor -> 2%,
Vice Manager -> 3%.

My current solution is to store all those configurations in a table,
e.g tbSETUP, which roughly has these fields:
Key <= this is the ID for the setup, not unique (hardcoded in app)
Value1 <= this is value number 1
Value2 <= this is value number 2 .. until 5.

Everytime I need to read these configuration, I will have to query the
table with the appropriate Setup ID and convert the value to my desired
data type, such as integer to include calculation. And this is becoming
so tedious typing it all over again.

Is there any elegant solution for storing and reading all these
configurations, or at least save time from converting all the
configuration value type?

I've tried googling a while and found some interesting topic on this
matter, a little bit similar to my situation, (such as serialize in xml
files, creating custom class xml, etc.), but I think this will be more
or less the same with my current solution.

Any opinion is appreciated :)

Thank you,
Hendry J
 
S

Stefan

Hi,

Maybe takeing an n-tier approach to your application or trying to
logicaly break down the config parameters into a set of small tables,
not just one.

You could also encapsulate all of the logic for you config parameters
into one class which does the work for you. Then when you need a
parameter you simply instantiate your class and call a method and it
returns your desired config parameter.

I have an article here which might help:

http://www.developersdex.com/gurus/articles/739.asp

Happy Coding,

Stefan
C# GURU
www.DotNETovation.com

"You always have to look beyond the horizon and can never be complacent
-- God forbid we become complacent."

Jozef Straus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top