title: Correct implementation of a custom config section with nested collections?
body: <p>In a web application, I want to be able to define some mapping using a config section like this:</p>
  
  <pre><code>&lt;configuration&gt;
      &lt;configSections&gt;
          &lt;sectionGroup name="MyCustomer"&gt;
              &lt;section name="CatalogMappings" type="MyCustom.MyConfigSection" /&gt;
          &lt;/sectionGroup&gt;
      &lt;/configSections&gt;
      &lt;MyCustomer&gt;
          &lt;catalogMappings&gt;
              &lt;catalog name="toto"&gt;
                  &lt;mapping value="1" displayText="titi" /&gt;
                  &lt;mapping value="2" displayText="tata" /&gt;
              &lt;/catalog&gt;
              &lt;catalog name="toto2"&gt;
                  &lt;mapping value="1" displayText="titi2" /&gt;
                  &lt;mapping value="2" displayText="tata2" /&gt;
              &lt;/catalog&gt;
          &lt;/catalogMappings&gt;
      &lt;/MyCustomer&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>I'm struggling to achieve this goal, especially when defining my collection of collections. What are the classes that I need to implement to achieve this?</p>
  
  <p>Currently, I have:</p>
  
  <pre><code>public class CatalogMappingSection : System.Configuration.ConfigurationSection
  {
      public class Mapping : ConfigurationElement
      {
          [ConfigurationProperty("externalKey")]
          public string ExternalKey { get; set; }
          [ConfigurationProperty("displayText", IsRequired=true)]
          public string DisplayText { get; set; }
          [ConfigurationProperty("value", IsRequired=true, IsKey=true)]
          public int Value { get; set; }
      }
  
      public class Catalog : ConfigurationElementCollection
      {
          [ConfigurationProperty("name", IsRequired=true, IsKey=true)]
          public string Name { get; set; }
  
          protected override ConfigurationElement CreateNewElement()
          {
              return new Mapping();
          }
  
          protected override object GetElementKey(ConfigurationElement element)
          {
              return ((Mapping)element).Value;
          }
      }
  
      public class CatalogCollection : ConfigurationElementCollection
      {
          [ConfigurationProperty("catalog")]
          [ConfigurationCollection(typeof(Catalog))]
          public Catalog CatalogMappingCollection
          {
              get
              {
                  return (Catalog)base["catalog"];
              }
          }
  
          protected override ConfigurationElement CreateNewElement()
          {
              return new Catalog();
          }
  
          protected override object GetElementKey(ConfigurationElement element)
          {
              return ((Catalog)element).Name;
          }
      }
  
      [ConfigurationProperty("catalogMappings")]
      [ConfigurationCollection(typeof(CatalogCollection))]
      public CatalogCollection CatalogMappings
      {
          get
          {
              return (CatalogCollection)base["catalogMappings"];
          }
      }
  }
  </code></pre>
  
  <p>But, this is not working as expected.</p>