A while ago, I removed the configuration handling that was embedded in the Axiom core. I firmly believe that how the configuration information is stored should be the decision of the Application Developer not the library. I kept the format and just moved the relevant classes into the Demos. That particular implementation relied on a custom Typed DataSet and really didn’t fit with the whole .Net configuration patterns. So I decided it was time to look into creating a custom configuration section for the App.config as an example of a good practice for storing engine configuration.

It’s been a long time since I last had to create a custom configuration section for a .Net application. The last time I looked at it was pre .Net 2.0. At that time you would create a class that implemented IConfigurationSectionHandler. Since .Net 2.0 there has been a change to now use ConfigurationSection or ConfigurationSectionGroup to derive from to create your configuration sections.

After spending roughly 6 hours implementing a simple custom configuration section handler, I had a working class. All it did was specify the log file so I could configure the Root object in Axiom, but it was working. The next step was to figure out how to build a set of elements to store ResourceLocations, RenderSystem Options and Plugins. And this is where I found out that build custom Configuration Sections was hard.

While researching the net for something, I came across a StackOverflow post that was fairly relevant ( I’m finding more of these are showing up higher in Google’s page ranks ). One of the followups to the post, was someone asking ‘why would you bother trying to code custom configuration sections by hand anymore, check out the Configuration Section Designer’. I cocked my head a little to the left and clicked the link to see if it was worth it.

  • Read the home page - 2 minutes
  • Download and Install - 5 minutes
  • Use the Designer to create section - 30 minutes

image

  • Not having to code that by hand - Priceless

I am not going to go into any detail on how to create these sections using the CSD, it really was very easy and intuitive to use. I only had about 5 minutes worth of pain as I figured out which properties are required, for the various elements. So the next time you want to create a custom configuration section, head on over to http://csd.codeplex.com and download the Configuration Section Designer and save yourself countless hours of coding and debugging.