Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - Custom Configuration Sections...

Reply
 
Old 09-11-2008   #1 (permalink)
Jason Richmeier


 
 

Custom Configuration Sections...

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

My System SpecsSystem Spec
Old 09-12-2008   #2 (permalink)
sloan


 
 

Re: Custom Configuration Sections...




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/de...onhandlers.asp )
// also see
http://support.microsoft.com/default...b;en-us;309045 // Article
ID : 309045


I have some code at:
http://sholliday.spaces.live.com/Blo...842A!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.





"Jason Richmeier" <JasonRichmeier@xxxxxx> wrote in
message news:A8D97959-8912-4A8F-9673-6FD2E02986CB@xxxxxx
Quote:

> 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

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Accessing custom types output from custom cmdlet's in C# GUI PowerShell
Reading Config Sections PowerShell
(My) Computer directory/folder... how do I show the drives in groups/sections ? Vista General
Why no looping of songs or Video sections in Media Players? Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46