Dynamically read/write in settings.xml

Topics: ASP.NET 2.0, Business Logic Layer, Controls
Dec 6, 2007 at 3:34 PM
Is there a way to easily add settings in the settings.xml, and have those incorperated in Blogsettings.Instance?

I have created a litte advertisement management tool and I have added a <adverts>true</adverts> to the settingsfile, but it won't show up in BlogSettings.Instance.
Can that be done? If so, what is the best way?

Cheers!
- jonah
Dec 6, 2007 at 8:30 PM
Looking at the code it appears that it reads all settings from the file and then tries to match each to a corresponding property in the class BlogEngine.Core.BlogSettings by name. So, if you were to add a property called Adverts of type bool to the class BlogEngine.Core.BlogSettings it should recognize it.
Dec 7, 2007 at 6:59 AM
That would mean that I would have to do a change to the core and recompile the project, right?
In that case it can't be done easily in runtime.
It would be better if there was a BlogSettings.Instance.Add(name, value) function which would incorporate values into the core.

What about it, Mads? ;)
Dec 7, 2007 at 11:25 AM
Edited Dec 7, 2007 at 11:25 AM
I agree with Jonah, and suggest that it could be nicer if he resource files worked also the same way.