1

I seem to be having some trouble identifying exactly how to verbally express what I'm trying to learn how to interact with. This is problematic from a search standpoint. I have been trying a variety of queries to find something related to the topic at hand, but have yet to be successful.

Part 1 of the question is: How do I address and/or describe this scenario?

I have an App.config with custom sections. I don't mean custom sections as in the attributes are "custom", I mean the entire node and its children are custom as follows:

<Business.Department.Domain.DomainConfiguration>
    <DomainPath path="path/to/place/"/>
    <OtherNode type="THING"/>
    <StartOfAnotherCustomSection>
        <OtherCustomThingsHere>
            <CustomThing Id="1" otherAttrib="PertinentDetails"/>
        </OtherCustomThingsHere>
    </StartOfAnotherCustomSection>
</Business.Department.Domain.DomainConfiguration>

Again, I'm looking for a way to address these "custom nodes", as consulting Google/SO by mentioning custom nodes in an App.config, it directs me to things like this:

On the MSDN side of things, I found a few links, this being one of them:

How to: Create Custom Configuration Sections Using ConfigurationSection

The problem is that this link and others like it are referring to the following:

<configSections>
    <sectionGroup name="pageAppearanceGroup">
        <section 
          name="pageAppearance" 
          type="Samples.AspNet.PageAppearanceSection" 
          allowLocation="true" 
          allowDefinition="Everywhere"
        />
    </sectionGroup>
    <!-- Other <section> and <sectionGroup> elements. -->
</configSections>

Part two (which may not be necessary to answer if identifying how to address my problem results in presenting me with a means of better finding material to self-study):

Since these nodes are a little unconventional, I'm not entirely sure how to access/traverse these settings. If I was to need to access the DomainPath node for its path value, how would I do such a thing?

abatishchev
  • 98,240
  • 88
  • 296
  • 433
EnergyWasRaw
  • 134
  • 8
  • 1
    Frankly, I'd not mess up with custom System.Configuration classes and end up storing settings in AppConfig in keys like `aa:bb:cc=foo`. Because what you get isn't worth how much time you spend. – abatishchev Jan 29 '15 at 19:30
  • No kidding. I wish it weren't the case that I had to deal with this stuff. But, I do. – EnergyWasRaw Jan 29 '15 at 20:42
  • The link you have is what you need. You need to define the custom sections in `configSections` and add your custom sections further along the file. You said there is a problem with defining the custom sections. What is the problem? – Malk Jan 29 '15 at 22:27
  • There is no problem with creating them. The part I am struggling with is finding reference material to guide me with accessing/traversing these settings per my question. – EnergyWasRaw Jan 29 '15 at 23:16

0 Answers0