Custom Configuration Sections...

J

Jason Richmeier

This may have been addressed in another post but I was unable to find what I
was looking for.

I am trying to create a custom configuration section that is element-centric
instead of attribute-centric (mostly out of preference).

For example...

<Date>
<Year>2008</Year>
<Month>09</Month>
<Day>11</Day>
</Date>

....instead of...

<Date Year="2008" Month="09" Day="11" />

If I am reading the documentation correctly, it sounds like this can be done
using the .NET 2.0 configuration API. However, either all of the examples
using the .NET 2.0 configuration API that I have found use an
attribute-centric approach or the examples use the older (pre .NET 2.0
configuration API) to create the custom configuration section.

Any ideas?

Thank you,

Jason
 
S

sloan

Are you using something like this?


public sealed class MyHandler : IConfigurationSectionHandler
{
public object Create(object parent, object configContext,
System.Xml.XmlNode section)
{
}}


In you are, then you can read out the xml (coming to you as "section") any
way you chose.

// The section handler interprets and processes the settings defined in
// XML tags within a specific portion of a Web.config file and returns an
// appropriate configuration object .... based on the configuration
settings.
// ( above exert from
http://msdn.microsoft.com/library/d...uide/html/cpconcreatingnewsectionhandlers.asp )
// also see
http://support.microsoft.com/default.aspx?scid=kb;en-us;309045 // Article
ID : 309045


I have some code at:
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!126.entry
if you want to look at it.
It's not specific to this issue, but I do use it the
IConfigurationSectionHandler there.


If you're doing something else, throw some more detail out there.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top