.net - Is a dynamic ConfigurationSection possible in a simple manner? -


In .NET 1.0, IConfigurationSectionHandler provided a clean, single-method interface for implementing the configuration handler.

In .NET 2, came with the configuration, with a great wild animal of complexity and static type enforcement, declaring a banner, "unknown evil will occur when you use IConfigurationSectionHandler!" .

Being rebellious, I am trying to noise a plugin architecture like an ancient, static frame like .NET 2, I want a dynamic configuration section. Nothing is stagnant, just a nice tree of XML nodes or nested key / value pair is something that plugins can use without defining delicate serialization codes.

Originally intended like XML, before it's fragile catch -22 web. Configurable horror and painful boilerplate became the cerealization tree.

Can I have an XMLElement example, or XMLReader, please?

Keeping in mind the age of this post, you may already have this self answer Got it ...

You can implement ConfigurationSection , which only needs to override the safe method DeserializeSection () . Your custom config section is required to follow the No attribute-based property pattern that is ideal for .NET 2 configuration.

DeserializeSection accepts a XmlReader as its sole parameter to parse XML from your section that XmlReader and you can expose that data in any way you choose.

Comments

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -