PC Review


Reply
Thread Tools Rate Thread

How to write code for this XML configuration section?

 
 
W. Jordan
Guest
Posts: n/a
 
      4th Apr 2006
Hello,

I would like to add a section in the configuration file like that:

<job name="cleanup">
<executor type="Test.MyExecutor"/>
<parameters>
<string name="outputFile" value="C:\output.log" />
<int name="maxValue" value="12" />
<timespan name="timespan" value="0:0:15"/>
</parameters>
</job>

A job can have multiple (0 to n) parameters. The parameters can be
some values, with a name, of any types.

How can I put it into the exe configuration file? And what kind of classes
should I build to support the configuration?


--


Best Regards,
W. Jordan




 
Reply With Quote
 
 
 
 
Kevin Spencer
Guest
Posts: n/a
 
      4th Apr 2006
What version of the .Net Framework?

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

"W. Jordan" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
>
> I would like to add a section in the configuration file like that:
>
> <job name="cleanup">
> <executor type="Test.MyExecutor"/>
> <parameters>
> <string name="outputFile" value="C:\output.log" />
> <int name="maxValue" value="12" />
> <timespan name="timespan" value="0:0:15"/>
> </parameters>
> </job>
>
> A job can have multiple (0 to n) parameters. The parameters can be
> some values, with a name, of any types.
>
> How can I put it into the exe configuration file? And what kind of classes
> should I build to support the configuration?
>
>
> --
>
>
> Best Regards,
> W. Jordan
>
>
>
>



 
Reply With Quote
 
W. Jordan
Guest
Posts: n/a
 
      6th Apr 2006
Oops, it is .net 2.0.

I saw something like ConfigurationSection, ConfigurationElement,
ConfigurationSectionGroup, and some other classes, but I did not
see an appropriate example of how to implement the XML config
that I posted at the beginning of this thread.

--


Best Regards,
W. Jordan



"Kevin Spencer" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> What version of the .Net Framework?
>
> --
> HTH,
>
> Kevin Spencer
> Microsoft MVP
> Professional Numbskull
>
> Show me your certification without works,
> and I'll show my certification
> *by* my works.
>
> "W. Jordan" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hello,
>>
>> I would like to add a section in the configuration file like that:
>>
>> <job name="cleanup">
>> <executor type="Test.MyExecutor"/>
>> <parameters>
>> <string name="outputFile" value="C:\output.log" />
>> <int name="maxValue" value="12" />
>> <timespan name="timespan" value="0:0:15"/>
>> </parameters>
>> </job>
>>
>> A job can have multiple (0 to n) parameters. The parameters can be
>> some values, with a name, of any types.
>>
>> How can I put it into the exe configuration file? And what kind of
>> classes
>> should I build to support the configuration?
>>
>>
>> --
>>
>>
>> Best Regards,
>> W. Jordan
>>
>>
>>
>>

>
>



 
Reply With Quote
 
Kevin Spencer
Guest
Posts: n/a
 
      6th Apr 2006
I'm not sure where you're looking, and therefore where you "saw" what you
saw. Since I don't know what resources you have available locally, I can
only point you to some references online.

First, the documentation for the .Net Framework 2.0 can be found at:
http://msdn2.microsoft.com/en-us/library/default.aspx

Notice that this is MSDN2, not MSDN.

Here are several other salient points of interest with regards to working
with Configuration in .Net 2.0:

http://msdn2.microsoft.com/en-us/library/kza1yk3a(VS.80).aspx
http://msdn2.microsoft.com/en-us/library/sbk7ee6x(VS.80).aspx
http://msdn2.microsoft.com/en-us/library/system.configuration(VS.80).aspx
http://msdn2.microsoft.com/en-us/library/1fk1t1t0(VS.80).aspx

Now, as to the specifics, you will want to look over the
System.Configuration Namespace:

http://msdn2.microsoft.com/en-us/library/system.configuration(VS.80).aspx

There are several classes in particular that you will work with most often:

http://msdn2.microsoft.com/en-us/library/system.configuration.configuration(VS.80).aspx
( Look for the sample code included)

http://msdn2.microsoft.com/en-us/library/system.configuration.configurationelement(VS.80).aspx
( Look for the sample code included)

http://msdn2.microsoft.com/en-us/library/system.configuration.configurationelementcollection(VS.80).aspx
( Look for the sample code included)

http://msdn2.microsoft.com/en-us/library/system.configuration.configurationmanager(VS.80).aspx
( Look for the sample code included)

http://msdn2.microsoft.com/en-us/library/system.configuration.configurationsection(VS.80).aspx
( Look for the sample code included)

http://msdn2.microsoft.com/en-us/library/system.configuration.configurationsectioncollection(VS.80).aspx
( Look for the sample code included)

http://msdn2.microsoft.com/en-us/library/system.configuration.configurationsectiongroup(VS.80).aspx
( Look for the sample code included)

http://msdn2.microsoft.com/en-us/library/system.configuration.configurationsectiongroupcollection(VS.80).aspx
( Look for the sample code included)

http://msdn2.microsoft.com/en-us/library/system.configuration.configurationsettings(VS.80).aspx
( Look for the sample code included)

These are your major players. the .Net Framework 2.0 has a much more
powerful and strongly-typed Configuration model. You will need to create
some custom Configuration classes to work with your custom Configuration
Sections.

The bottom-most class is the ConfigurationElement class, which is used for
individual Configuration Elements, at the lowest node level of the XML.
Above this, you have the ConfigurationElementCollection, which manages a
collection of ConfigurationElements.

Generally, you will also need a ConfigurationSection, and possibly a
ConfigurationSectionGroup class to group your ConfigurationElements into
Sections.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.


"W. Jordan" <(E-Mail Removed)> wrote in message
news:O%(E-Mail Removed)...
> Oops, it is .net 2.0.
>
> I saw something like ConfigurationSection, ConfigurationElement,
> ConfigurationSectionGroup, and some other classes, but I did not
> see an appropriate example of how to implement the XML config
> that I posted at the beginning of this thread.
>
> --
>
>
> Best Regards,
> W. Jordan
>
>
>
> "Kevin Spencer" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> What version of the .Net Framework?
>>
>> --
>> HTH,
>>
>> Kevin Spencer
>> Microsoft MVP
>> Professional Numbskull
>>
>> Show me your certification without works,
>> and I'll show my certification
>> *by* my works.
>>
>> "W. Jordan" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Hello,
>>>
>>> I would like to add a section in the configuration file like that:
>>>
>>> <job name="cleanup">
>>> <executor type="Test.MyExecutor"/>
>>> <parameters>
>>> <string name="outputFile" value="C:\output.log" />
>>> <int name="maxValue" value="12" />
>>> <timespan name="timespan" value="0:0:15"/>
>>> </parameters>
>>> </job>
>>>
>>> A job can have multiple (0 to n) parameters. The parameters can be
>>> some values, with a name, of any types.
>>>
>>> How can I put it into the exe configuration file? And what kind of
>>> classes
>>> should I build to support the configuration?
>>>
>>>
>>> --
>>>
>>>
>>> Best Regards,
>>> W. Jordan
>>>
>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
W. Jordan
Guest
Posts: n/a
 
      7th Apr 2006
Hello Kevin,

I am sorry that I am inexperienced. I have the .Net Framework 2.0
Documentation installed on my machine. Thanks for pointing out the
locations of the online resources. I will learn those examples and
try to find out a way to implement my XML configuration sections.


--


Best Regards,
W. Jordan



"Kevin Spencer" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I'm not sure where you're looking, and therefore where you "saw" what you
> saw. Since I don't know what resources you have available locally, I can
> only point you to some references online.
>
> First, the documentation for the .Net Framework 2.0 can be found at:
> http://msdn2.microsoft.com/en-us/library/default.aspx
>
> Notice that this is MSDN2, not MSDN.
>
> Here are several other salient points of interest with regards to working
> with Configuration in .Net 2.0:
>
> http://msdn2.microsoft.com/en-us/library/kza1yk3a(VS.80).aspx
> http://msdn2.microsoft.com/en-us/library/sbk7ee6x(VS.80).aspx
> http://msdn2.microsoft.com/en-us/library/system.configuration(VS.80).aspx
> http://msdn2.microsoft.com/en-us/library/1fk1t1t0(VS.80).aspx
>
> Now, as to the specifics, you will want to look over the
> System.Configuration Namespace:
>
> http://msdn2.microsoft.com/en-us/library/system.configuration(VS.80).aspx
>
> There are several classes in particular that you will work with most
> often:
>
> http://msdn2.microsoft.com/en-us/library/system.configuration.configuration(VS.80).aspx
> ( Look for the sample code included)
>
> http://msdn2.microsoft.com/en-us/library/system.configuration.configurationelement(VS.80).aspx
> ( Look for the sample code included)
>
> http://msdn2.microsoft.com/en-us/library/system.configuration.configurationelementcollection(VS.80).aspx
> ( Look for the sample code included)
>
> http://msdn2.microsoft.com/en-us/library/system.configuration.configurationmanager(VS.80).aspx
> ( Look for the sample code included)
>
> http://msdn2.microsoft.com/en-us/library/system.configuration.configurationsection(VS.80).aspx
> ( Look for the sample code included)
>
> http://msdn2.microsoft.com/en-us/library/system.configuration.configurationsectioncollection(VS.80).aspx
> ( Look for the sample code included)
>
> http://msdn2.microsoft.com/en-us/library/system.configuration.configurationsectiongroup(VS.80).aspx
> ( Look for the sample code included)
>
> http://msdn2.microsoft.com/en-us/library/system.configuration.configurationsectiongroupcollection(VS.80).aspx
> ( Look for the sample code included)
>
> http://msdn2.microsoft.com/en-us/library/system.configuration.configurationsettings(VS.80).aspx
> ( Look for the sample code included)
>
> These are your major players. the .Net Framework 2.0 has a much more
> powerful and strongly-typed Configuration model. You will need to create
> some custom Configuration classes to work with your custom Configuration
> Sections.
>
> The bottom-most class is the ConfigurationElement class, which is used for
> individual Configuration Elements, at the lowest node level of the XML.
> Above this, you have the ConfigurationElementCollection, which manages a
> collection of ConfigurationElements.
>
> Generally, you will also need a ConfigurationSection, and possibly a
> ConfigurationSectionGroup class to group your ConfigurationElements into
> Sections.
>
> --
> HTH,
>
> Kevin Spencer
> Microsoft MVP
> Professional Numbskull
>
> Show me your certification without works,
> and I'll show my certification
> *by* my works.
>
>
> "W. Jordan" <(E-Mail Removed)> wrote in message
> news:O%(E-Mail Removed)...
>> Oops, it is .net 2.0.
>>
>> I saw something like ConfigurationSection, ConfigurationElement,
>> ConfigurationSectionGroup, and some other classes, but I did not
>> see an appropriate example of how to implement the XML config
>> that I posted at the beginning of this thread.
>>
>> --
>>
>>
>> Best Regards,
>> W. Jordan
>>
>>
>>
>> "Kevin Spencer" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> What version of the .Net Framework?
>>>
>>> --
>>> HTH,
>>>
>>> Kevin Spencer
>>> Microsoft MVP
>>> Professional Numbskull
>>>
>>> Show me your certification without works,
>>> and I'll show my certification
>>> *by* my works.
>>>
>>> "W. Jordan" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed)...
>>>> Hello,
>>>>
>>>> I would like to add a section in the configuration file like that:
>>>>
>>>> <job name="cleanup">
>>>> <executor type="Test.MyExecutor"/>
>>>> <parameters>
>>>> <string name="outputFile" value="C:\output.log" />
>>>> <int name="maxValue" value="12" />
>>>> <timespan name="timespan" value="0:0:15"/>
>>>> </parameters>
>>>> </job>
>>>>
>>>> A job can have multiple (0 to n) parameters. The parameters can be
>>>> some values, with a name, of any types.
>>>>
>>>> How can I put it into the exe configuration file? And what kind of
>>>> classes
>>>> should I build to support the configuration?
>>>>
>>>>
>>>> --
>>>>
>>>>
>>>> Best Regards,
>>>> W. Jordan
>>>>
>>>>
>>>>
>>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
Kevin Spencer
Guest
Posts: n/a
 
      7th Apr 2006
Don't be discouraged. When I first started working with the new
configuration model, I had a hard time figuring it out myself.
Unfortunately, that was about a year ago, and I had nobody to point me to at
least the right classes and points of reference. Once I figured those out,
the rest was not so difficult.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

"W. Jordan" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello Kevin,
>
> I am sorry that I am inexperienced. I have the .Net Framework 2.0
> Documentation installed on my machine. Thanks for pointing out the
> locations of the online resources. I will learn those examples and
> try to find out a way to implement my XML configuration sections.
>
>
> --
>
>
> Best Regards,
> W. Jordan
>
>
>
> "Kevin Spencer" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> I'm not sure where you're looking, and therefore where you "saw" what you
>> saw. Since I don't know what resources you have available locally, I can
>> only point you to some references online.
>>
>> First, the documentation for the .Net Framework 2.0 can be found at:
>> http://msdn2.microsoft.com/en-us/library/default.aspx
>>
>> Notice that this is MSDN2, not MSDN.
>>
>> Here are several other salient points of interest with regards to working
>> with Configuration in .Net 2.0:
>>
>> http://msdn2.microsoft.com/en-us/library/kza1yk3a(VS.80).aspx
>> http://msdn2.microsoft.com/en-us/library/sbk7ee6x(VS.80).aspx
>> http://msdn2.microsoft.com/en-us/library/system.configuration(VS.80).aspx
>> http://msdn2.microsoft.com/en-us/library/1fk1t1t0(VS.80).aspx
>>
>> Now, as to the specifics, you will want to look over the
>> System.Configuration Namespace:
>>
>> http://msdn2.microsoft.com/en-us/library/system.configuration(VS.80).aspx
>>
>> There are several classes in particular that you will work with most
>> often:
>>
>> http://msdn2.microsoft.com/en-us/library/system.configuration.configuration(VS.80).aspx
>> ( Look for the sample code included)
>>
>> http://msdn2.microsoft.com/en-us/library/system.configuration.configurationelement(VS.80).aspx
>> ( Look for the sample code included)
>>
>> http://msdn2.microsoft.com/en-us/library/system.configuration.configurationelementcollection(VS.80).aspx
>> ( Look for the sample code included)
>>
>> http://msdn2.microsoft.com/en-us/library/system.configuration.configurationmanager(VS.80).aspx
>> ( Look for the sample code included)
>>
>> http://msdn2.microsoft.com/en-us/library/system.configuration.configurationsection(VS.80).aspx
>> ( Look for the sample code included)
>>
>> http://msdn2.microsoft.com/en-us/library/system.configuration.configurationsectioncollection(VS.80).aspx
>> ( Look for the sample code included)
>>
>> http://msdn2.microsoft.com/en-us/library/system.configuration.configurationsectiongroup(VS.80).aspx
>> ( Look for the sample code included)
>>
>> http://msdn2.microsoft.com/en-us/library/system.configuration.configurationsectiongroupcollection(VS.80).aspx
>> ( Look for the sample code included)
>>
>> http://msdn2.microsoft.com/en-us/library/system.configuration.configurationsettings(VS.80).aspx
>> ( Look for the sample code included)
>>
>> These are your major players. the .Net Framework 2.0 has a much more
>> powerful and strongly-typed Configuration model. You will need to create
>> some custom Configuration classes to work with your custom Configuration
>> Sections.
>>
>> The bottom-most class is the ConfigurationElement class, which is used
>> for individual Configuration Elements, at the lowest node level of the
>> XML. Above this, you have the ConfigurationElementCollection, which
>> manages a collection of ConfigurationElements.
>>
>> Generally, you will also need a ConfigurationSection, and possibly a
>> ConfigurationSectionGroup class to group your ConfigurationElements into
>> Sections.
>>
>> --
>> HTH,
>>
>> Kevin Spencer
>> Microsoft MVP
>> Professional Numbskull
>>
>> Show me your certification without works,
>> and I'll show my certification
>> *by* my works.
>>
>>
>> "W. Jordan" <(E-Mail Removed)> wrote in message
>> news:O%(E-Mail Removed)...
>>> Oops, it is .net 2.0.
>>>
>>> I saw something like ConfigurationSection, ConfigurationElement,
>>> ConfigurationSectionGroup, and some other classes, but I did not
>>> see an appropriate example of how to implement the XML config
>>> that I posted at the beginning of this thread.
>>>
>>> --
>>>
>>>
>>> Best Regards,
>>> W. Jordan
>>>
>>>
>>>
>>> "Kevin Spencer" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed)...
>>>> What version of the .Net Framework?
>>>>
>>>> --
>>>> HTH,
>>>>
>>>> Kevin Spencer
>>>> Microsoft MVP
>>>> Professional Numbskull
>>>>
>>>> Show me your certification without works,
>>>> and I'll show my certification
>>>> *by* my works.
>>>>
>>>> "W. Jordan" <(E-Mail Removed)> wrote in message
>>>> news:(E-Mail Removed)...
>>>>> Hello,
>>>>>
>>>>> I would like to add a section in the configuration file like that:
>>>>>
>>>>> <job name="cleanup">
>>>>> <executor type="Test.MyExecutor"/>
>>>>> <parameters>
>>>>> <string name="outputFile" value="C:\output.log" />
>>>>> <int name="maxValue" value="12" />
>>>>> <timespan name="timespan" value="0:0:15"/>
>>>>> </parameters>
>>>>> </job>
>>>>>
>>>>> A job can have multiple (0 to n) parameters. The parameters can be
>>>>> some values, with a name, of any types.
>>>>>
>>>>> How can I put it into the exe configuration file? And what kind of
>>>>> classes
>>>>> should I build to support the configuration?
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>>
>>>>> Best Regards,
>>>>> W. Jordan
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
=?Utf-8?B?VGltIEpvaG5zb24=?=
Guest
Posts: n/a
 
      23rd Apr 2006
There was a really excellent article on "The Last Configuration File I'll
Ever Need" that applied to .Net v1.0.

http://www.codinghorror.com/blog/archives/000161.html

But I've never seen any update anywhere related to .Net v2.0. It basically
uses XML serialization to make generic section readers, as I understand it.
Do you have any insight on an updated version of this valuable technique for
v2.0?

"Kevin Spencer" wrote:

> Don't be discouraged. When I first started working with the new
> configuration model, I had a hard time figuring it out myself.
> Unfortunately, that was about a year ago, and I had nobody to point me to at
> least the right classes and points of reference. Once I figured those out,
> the rest was not so difficult.
>
> --
> HTH,
>
> Kevin Spencer
> Microsoft MVP
> Professional Numbskull
>
> Show me your certification without works,
> and I'll show my certification
> *by* my works.
>
> "W. Jordan" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hello Kevin,
> >
> > I am sorry that I am inexperienced. I have the .Net Framework 2.0
> > Documentation installed on my machine. Thanks for pointing out the
> > locations of the online resources. I will learn those examples and
> > try to find out a way to implement my XML configuration sections.
> >
> >
> > --
> >
> >
> > Best Regards,
> > W. Jordan
> >
> >
> >
> > "Kevin Spencer" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> >> I'm not sure where you're looking, and therefore where you "saw" what you
> >> saw. Since I don't know what resources you have available locally, I can
> >> only point you to some references online.
> >>
> >> First, the documentation for the .Net Framework 2.0 can be found at:
> >> http://msdn2.microsoft.com/en-us/library/default.aspx
> >>
> >> Notice that this is MSDN2, not MSDN.
> >>
> >> Here are several other salient points of interest with regards to working
> >> with Configuration in .Net 2.0:
> >>
> >> http://msdn2.microsoft.com/en-us/library/kza1yk3a(VS.80).aspx
> >> http://msdn2.microsoft.com/en-us/library/sbk7ee6x(VS.80).aspx
> >> http://msdn2.microsoft.com/en-us/library/system.configuration(VS.80).aspx
> >> http://msdn2.microsoft.com/en-us/library/1fk1t1t0(VS.80).aspx
> >>
> >> Now, as to the specifics, you will want to look over the
> >> System.Configuration Namespace:
> >>
> >> http://msdn2.microsoft.com/en-us/library/system.configuration(VS.80).aspx
> >>
> >> There are several classes in particular that you will work with most
> >> often:
> >>
> >> http://msdn2.microsoft.com/en-us/library/system.configuration.configuration(VS.80).aspx
> >> ( Look for the sample code included)
> >>
> >> http://msdn2.microsoft.com/en-us/library/system.configuration.configurationelement(VS.80).aspx
> >> ( Look for the sample code included)
> >>
> >> http://msdn2.microsoft.com/en-us/library/system.configuration.configurationelementcollection(VS.80).aspx
> >> ( Look for the sample code included)
> >>
> >> http://msdn2.microsoft.com/en-us/library/system.configuration.configurationmanager(VS.80).aspx
> >> ( Look for the sample code included)
> >>
> >> http://msdn2.microsoft.com/en-us/library/system.configuration.configurationsection(VS.80).aspx
> >> ( Look for the sample code included)
> >>
> >> http://msdn2.microsoft.com/en-us/library/system.configuration.configurationsectioncollection(VS.80).aspx
> >> ( Look for the sample code included)
> >>
> >> http://msdn2.microsoft.com/en-us/library/system.configuration.configurationsectiongroup(VS.80).aspx
> >> ( Look for the sample code included)
> >>
> >> http://msdn2.microsoft.com/en-us/library/system.configuration.configurationsectiongroupcollection(VS.80).aspx
> >> ( Look for the sample code included)
> >>
> >> http://msdn2.microsoft.com/en-us/library/system.configuration.configurationsettings(VS.80).aspx
> >> ( Look for the sample code included)
> >>
> >> These are your major players. the .Net Framework 2.0 has a much more
> >> powerful and strongly-typed Configuration model. You will need to create
> >> some custom Configuration classes to work with your custom Configuration
> >> Sections.
> >>
> >> The bottom-most class is the ConfigurationElement class, which is used
> >> for individual Configuration Elements, at the lowest node level of the
> >> XML. Above this, you have the ConfigurationElementCollection, which
> >> manages a collection of ConfigurationElements.
> >>
> >> Generally, you will also need a ConfigurationSection, and possibly a
> >> ConfigurationSectionGroup class to group your ConfigurationElements into
> >> Sections.
> >>
> >> --
> >> HTH,
> >>
> >> Kevin Spencer
> >> Microsoft MVP
> >> Professional Numbskull
> >>
> >> Show me your certification without works,
> >> and I'll show my certification
> >> *by* my works.
> >>
> >>
> >> "W. Jordan" <(E-Mail Removed)> wrote in message
> >> news:O%(E-Mail Removed)...
> >>> Oops, it is .net 2.0.
> >>>
> >>> I saw something like ConfigurationSection, ConfigurationElement,
> >>> ConfigurationSectionGroup, and some other classes, but I did not
> >>> see an appropriate example of how to implement the XML config
> >>> that I posted at the beginning of this thread.
> >>>
> >>> --
> >>>
> >>>
> >>> Best Regards,
> >>> W. Jordan
> >>>
> >>>
> >>>
> >>> "Kevin Spencer" <(E-Mail Removed)> wrote in message
> >>> news:(E-Mail Removed)...
> >>>> What version of the .Net Framework?
> >>>>
> >>>> --
> >>>> HTH,
> >>>>
> >>>> Kevin Spencer
> >>>> Microsoft MVP
> >>>> Professional Numbskull
> >>>>
> >>>> Show me your certification without works,
> >>>> and I'll show my certification
> >>>> *by* my works.
> >>>>
> >>>> "W. Jordan" <(E-Mail Removed)> wrote in message
> >>>> news:(E-Mail Removed)...
> >>>>> Hello,
> >>>>>
> >>>>> I would like to add a section in the configuration file like that:
> >>>>>
> >>>>> <job name="cleanup">
> >>>>> <executor type="Test.MyExecutor"/>
> >>>>> <parameters>
> >>>>> <string name="outputFile" value="C:\output.log" />
> >>>>> <int name="maxValue" value="12" />
> >>>>> <timespan name="timespan" value="0:0:15"/>
> >>>>> </parameters>
> >>>>> </job>
> >>>>>
> >>>>> A job can have multiple (0 to n) parameters. The parameters can be
> >>>>> some values, with a name, of any types.
> >>>>>
> >>>>> How can I put it into the exe configuration file? And what kind of
> >>>>> classes
> >>>>> should I build to support the configuration?
> >>>>>
> >>>>>
> >>>>> --
> >>>>>
> >>>>>
> >>>>> Best Regards,
> >>>>> W. Jordan
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>
> >>>>
> >>>
> >>>
> >>
> >>

> >
> >

>
>
>

 
Reply With Quote
 
Kevin Spencer
Guest
Posts: n/a
 
      23rd Apr 2006
Configuration in .Net 2.0 is fundamentally different than in .Net 1.1. I
would advise you to stick with the resources I posted!

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.

"Tim Johnson" <(E-Mail Removed)> wrote in message
news:67B9BE2B-EF5A-4BA6-A54C-(E-Mail Removed)...
> There was a really excellent article on "The Last Configuration File I'll
> Ever Need" that applied to .Net v1.0.
>
> http://www.codinghorror.com/blog/archives/000161.html
>
> But I've never seen any update anywhere related to .Net v2.0. It
> basically
> uses XML serialization to make generic section readers, as I understand
> it.
> Do you have any insight on an updated version of this valuable technique
> for
> v2.0?
>
> "Kevin Spencer" wrote:
>
>> Don't be discouraged. When I first started working with the new
>> configuration model, I had a hard time figuring it out myself.
>> Unfortunately, that was about a year ago, and I had nobody to point me to
>> at
>> least the right classes and points of reference. Once I figured those
>> out,
>> the rest was not so difficult.
>>
>> --
>> HTH,
>>
>> Kevin Spencer
>> Microsoft MVP
>> Professional Numbskull
>>
>> Show me your certification without works,
>> and I'll show my certification
>> *by* my works.
>>
>> "W. Jordan" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > Hello Kevin,
>> >
>> > I am sorry that I am inexperienced. I have the .Net Framework 2.0
>> > Documentation installed on my machine. Thanks for pointing out the
>> > locations of the online resources. I will learn those examples and
>> > try to find out a way to implement my XML configuration sections.
>> >
>> >
>> > --
>> >
>> >
>> > Best Regards,
>> > W. Jordan
>> >
>> >
>> >
>> > "Kevin Spencer" <(E-Mail Removed)> wrote in message
>> > news:(E-Mail Removed)...
>> >> I'm not sure where you're looking, and therefore where you "saw" what
>> >> you
>> >> saw. Since I don't know what resources you have available locally, I
>> >> can
>> >> only point you to some references online.
>> >>
>> >> First, the documentation for the .Net Framework 2.0 can be found at:
>> >> http://msdn2.microsoft.com/en-us/library/default.aspx
>> >>
>> >> Notice that this is MSDN2, not MSDN.
>> >>
>> >> Here are several other salient points of interest with regards to
>> >> working
>> >> with Configuration in .Net 2.0:
>> >>
>> >> http://msdn2.microsoft.com/en-us/library/kza1yk3a(VS.80).aspx
>> >> http://msdn2.microsoft.com/en-us/library/sbk7ee6x(VS.80).aspx
>> >> http://msdn2.microsoft.com/en-us/library/system.configuration(VS.80).aspx
>> >> http://msdn2.microsoft.com/en-us/library/1fk1t1t0(VS.80).aspx
>> >>
>> >> Now, as to the specifics, you will want to look over the
>> >> System.Configuration Namespace:
>> >>
>> >> http://msdn2.microsoft.com/en-us/library/system.configuration(VS.80).aspx
>> >>
>> >> There are several classes in particular that you will work with most
>> >> often:
>> >>
>> >> http://msdn2.microsoft.com/en-us/library/system.configuration.configuration(VS.80).aspx
>> >> ( Look for the sample code included)
>> >>
>> >> http://msdn2.microsoft.com/en-us/library/system.configuration.configurationelement(VS.80).aspx
>> >> ( Look for the sample code included)
>> >>
>> >> http://msdn2.microsoft.com/en-us/library/system.configuration.configurationelementcollection(VS.80).aspx
>> >> ( Look for the sample code included)
>> >>
>> >> http://msdn2.microsoft.com/en-us/library/system.configuration.configurationmanager(VS.80).aspx
>> >> ( Look for the sample code included)
>> >>
>> >> http://msdn2.microsoft.com/en-us/library/system.configuration.configurationsection(VS.80).aspx
>> >> ( Look for the sample code included)
>> >>
>> >> http://msdn2.microsoft.com/en-us/library/system.configuration.configurationsectioncollection(VS.80).aspx
>> >> ( Look for the sample code included)
>> >>
>> >> http://msdn2.microsoft.com/en-us/library/system.configuration.configurationsectiongroup(VS.80).aspx
>> >> ( Look for the sample code included)
>> >>
>> >> http://msdn2.microsoft.com/en-us/library/system.configuration.configurationsectiongroupcollection(VS.80).aspx
>> >> ( Look for the sample code included)
>> >>
>> >> http://msdn2.microsoft.com/en-us/library/system.configuration.configurationsettings(VS.80).aspx
>> >> ( Look for the sample code included)
>> >>
>> >> These are your major players. the .Net Framework 2.0 has a much more
>> >> powerful and strongly-typed Configuration model. You will need to
>> >> create
>> >> some custom Configuration classes to work with your custom
>> >> Configuration
>> >> Sections.
>> >>
>> >> The bottom-most class is the ConfigurationElement class, which is used
>> >> for individual Configuration Elements, at the lowest node level of the
>> >> XML. Above this, you have the ConfigurationElementCollection, which
>> >> manages a collection of ConfigurationElements.
>> >>
>> >> Generally, you will also need a ConfigurationSection, and possibly a
>> >> ConfigurationSectionGroup class to group your ConfigurationElements
>> >> into
>> >> Sections.
>> >>
>> >> --
>> >> HTH,
>> >>
>> >> Kevin Spencer
>> >> Microsoft MVP
>> >> Professional Numbskull
>> >>
>> >> Show me your certification without works,
>> >> and I'll show my certification
>> >> *by* my works.
>> >>
>> >>
>> >> "W. Jordan" <(E-Mail Removed)> wrote in message
>> >> news:O%(E-Mail Removed)...
>> >>> Oops, it is .net 2.0.
>> >>>
>> >>> I saw something like ConfigurationSection, ConfigurationElement,
>> >>> ConfigurationSectionGroup, and some other classes, but I did not
>> >>> see an appropriate example of how to implement the XML config
>> >>> that I posted at the beginning of this thread.
>> >>>
>> >>> --
>> >>>
>> >>>
>> >>> Best Regards,
>> >>> W. Jordan
>> >>>
>> >>>
>> >>>
>> >>> "Kevin Spencer" <(E-Mail Removed)> wrote in message
>> >>> news:(E-Mail Removed)...
>> >>>> What version of the .Net Framework?
>> >>>>
>> >>>> --
>> >>>> HTH,
>> >>>>
>> >>>> Kevin Spencer
>> >>>> Microsoft MVP
>> >>>> Professional Numbskull
>> >>>>
>> >>>> Show me your certification without works,
>> >>>> and I'll show my certification
>> >>>> *by* my works.
>> >>>>
>> >>>> "W. Jordan" <(E-Mail Removed)> wrote in message
>> >>>> news:(E-Mail Removed)...
>> >>>>> Hello,
>> >>>>>
>> >>>>> I would like to add a section in the configuration file like that:
>> >>>>>
>> >>>>> <job name="cleanup">
>> >>>>> <executor type="Test.MyExecutor"/>
>> >>>>> <parameters>
>> >>>>> <string name="outputFile" value="C:\output.log" />
>> >>>>> <int name="maxValue" value="12" />
>> >>>>> <timespan name="timespan" value="0:0:15"/>
>> >>>>> </parameters>
>> >>>>> </job>
>> >>>>>
>> >>>>> A job can have multiple (0 to n) parameters. The parameters can be
>> >>>>> some values, with a name, of any types.
>> >>>>>
>> >>>>> How can I put it into the exe configuration file? And what kind of
>> >>>>> classes
>> >>>>> should I build to support the configuration?
>> >>>>>
>> >>>>>
>> >>>>> --
>> >>>>>
>> >>>>>
>> >>>>> Best Regards,
>> >>>>> W. Jordan
>> >>>>>
>> >>>>>
>> >>>>>
>> >>>>>
>> >>>>
>> >>>>
>> >>>
>> >>>
>> >>
>> >>
>> >
>> >

>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Configuration Section shapper Microsoft C# .NET 3 25th Oct 2010 02:47 AM
Custom Configuration Section Handler and Code Access Security =?Utf-8?B?RG91Z2llIEJyb3du?= Microsoft Dot NET 8 28th Jun 2007 04:35 PM
RE: Enterprise Library exception: The configuration section securityCryptographyConfiguration is not defined in the current configuration for the AppDomain. Steven Cheng[MSFT] Microsoft ASP .NET 0 21st Sep 2006 11:18 AM
when I try to write a new section another section appeard. =?Utf-8?B?bGF0aWZnYWNoa2Fy?= Microsoft Word Document Management 1 6th Aug 2006 07:29 PM
.net 2.0 configuration section. Ashish Microsoft ASP .NET 3 14th Dec 2005 12:35 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:26 AM.