The .NET 2.0 and up configuration system is quite powerful and extensible - as long as you don't want to change the fact it all comes from XML files in the filesystem.
In my requirement, I cannot change files since my app runs in a managed environment outside my reach - but I could change the SQL Server database.
So I am looking at storing configuration files or sections in a SQL table - but how can I tie the .NET 2.0 configuration system into this??
Is there a way to write a "custom config provider" that will read its config sections not from a *.config file in the file system, but from a table in the SQL database??
I've been looking at creating my own custom ConfigurationSection or ConfigurationElement, or even a custom Configuration per se - but it seems I always end up back at the point that I can extend the config-system in the filesystem as much as I like, but I can't make it read my XML fragments from a database table.....
What am I missing? Has someone done this already and care to explain / share?
Thanks!
Marc
PS: I also tried to just read the config XML into a string, and then deserializing it into the appropriate e.g. ServiceModelConfigSection - that doesn't work, unfortunately, because the ConfigSection base class somehow doesn't implement a method that is required for it to be XML serializable ........ (YIKES!!!)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…