1

I have implemented a custom file configuration, that uses custom sections, using C#. The main issue i have is with implementing some kind of version aware configuration loader. Confgiurations change, but we need to make them usable anyway. Is there any documentation that points in the direction of having some kind of versioning in configurations?

I'll give you two examples on what my issues are: - key["key1"] changes from boolean type to int type. - key["key2"] mandatory ceases to exist

thanks.

2 Answers 2

0

My tendency would be to add some kind of version header to the configs and keep a history of their schemas in the app. It could be troublesome in some ways, but at least you don't have to guess what an old value meant.

0

You could have the concept of default values for each setting. If you introduce a new setting and an old config file doesn't have it then it would use the default value. Similarly, if you remove a setting from the code then its existence in the config file would be harmless, it would just be ignored.

If you want to change how a given setting works (the type or the format) then it's a little more tricky. You could try to parse the value and if it's not in the right format you could ignore it and use the default value.

1
  • Well ... i already have a field of version. I think the best is to parse the values of the conf and eliminate/convert the fields depending on the version field.
    – LMatos
    Commented Nov 7, 2013 at 11:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.