473,386 Members | 1,602 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

more values in one section of app.config

Hi

I want tu use an app.config like the example below. The problem is, that i
don't know how many Action-Tags there will be, because this can be changed
by the user. When using
System.Configuration.ConfigurationSettings.GetConf ig("IncomingActions/action
") I can access the config file, but get only the values of the Last
Action-Tag.
Does someone know, how to implement that using the app.config file?

Thanks

Patrick

<configSections>

<sectionGroup name="IncomingActions">

<section name="action"
type="System.Configuration.SingleTagSectionHandler " />

</sectionGroup>

</configSections>

<IncomingActions>

<action From="Value11" Message="value two1" Command="third value1"
Confirm="y" />

<action From="Value21" Message="value two2" Command="third value2"
Confirm="y" />

<action From="Value31" Message="value two3" Command="third value3"
Confirm="y" />

<action From="Value41" Message="value two4" Command="third value4"
Confirm="y" />

</IncomingActions>
Jul 21 '05 #1
4 5984
Hi Patrick,

I would suggest you put those config settings in another XML file, so you
can parse it and create a collection ( or maybe a Hashtable ) to contain
them.
You can create a class Config with a static constructor ( to be sure it will
be called before you use this class ) from where you load/parse the config.

Then you can have properties ( I suggest static too ) that you have access
to the settings.
Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Patrick" <pa********@bluemail.ch> wrote in message
news:10***************@fuchs.cyberlink.ch...
Hi

I want tu use an app.config like the example below. The problem is, that i
don't know how many Action-Tags there will be, because this can be changed
by the user. When using
System.Configuration.ConfigurationSettings.GetConf ig("IncomingActions/action ") I can access the config file, but get only the values of the Last
Action-Tag.
Does someone know, how to implement that using the app.config file?

Thanks

Patrick

<configSections>

<sectionGroup name="IncomingActions">

<section name="action"
type="System.Configuration.SingleTagSectionHandler " />

</sectionGroup>

</configSections>

<IncomingActions>

<action From="Value11" Message="value two1" Command="third value1"
Confirm="y" />

<action From="Value21" Message="value two2" Command="third value2"
Confirm="y" />

<action From="Value31" Message="value two3" Command="third value3"
Confirm="y" />

<action From="Value41" Message="value two4" Command="third value4"
Confirm="y" />

</IncomingActions>

Jul 21 '05 #2
Patrick,
In addition to Ignacio's suggestion of creating "another XML" file.

You can actually do this with a single XML file the app.config itself.

The trick is, instead of defining IncomingActions as a sectionGroup with a
nested SingleTagSectinoHandler. You define IncomingActions as a custom
Configuration Section Handler. You do this by implementing the
System.Configuration.IConfigurationSectionHandler interface, then using the
XML dom parse the XML Node.

I would have the IncomingActions handler return a collection of Action
objects.

I do not have a link to a handy sample right now. If you need one post and I
will try to find the links to the two or three I found earlier.

Hope this helps
Jay

"Patrick" <pa********@bluemail.ch> wrote in message
news:10***************@fuchs.cyberlink.ch...
Hi

I want tu use an app.config like the example below. The problem is, that i
don't know how many Action-Tags there will be, because this can be changed
by the user. When using
System.Configuration.ConfigurationSettings.GetConf ig("IncomingActions/action ") I can access the config file, but get only the values of the Last
Action-Tag.
Does someone know, how to implement that using the app.config file?

Thanks

Patrick

<configSections>

<sectionGroup name="IncomingActions">

<section name="action"
type="System.Configuration.SingleTagSectionHandler " />

</sectionGroup>

</configSections>

<IncomingActions>

<action From="Value11" Message="value two1" Command="third value1"
Confirm="y" />

<action From="Value21" Message="value two2" Command="third value2"
Confirm="y" />

<action From="Value31" Message="value two3" Command="third value3"
Confirm="y" />

<action From="Value41" Message="value two4" Command="third value4"
Confirm="y" />

</IncomingActions>

Jul 21 '05 #3
Hi

Instead of defining you section type as :
type="System.Configuration.SingleTagSectionHandler
use the following :
type="System.Configuration.NameValueSectionHandler

Then use the getCongig function that return a
NameValueColection an all value will be then retrive from
the section.

U can then browse the desired item of the collection and
process accordingly.

That works really fine, I am doing it like that for my app
config file whcih have different section group

regards
serge
-----Original Message-----
Hi

I want tu use an app.config like the example below. The problem is, that idon't know how many Action-Tags there will be, because this can be changedby the user. When using
System.Configuration.ConfigurationSettings.GetCon fig ("IncomingActions/action") I can access the config file, but get only the values of the LastAction-Tag.
Does someone know, how to implement that using the app.config file?
Thanks

Patrick

<configSections>

<sectionGroup name="IncomingActions">

<section name="action"
type="System.Configuration.SingleTagSectionHandle r" />

</sectionGroup>

</configSections>

<IncomingActions>

<action From="Value11" Message="value two1" Command="third value1"Confirm="y" />

<action From="Value21" Message="value two2" Command="third value2"Confirm="y" />

<action From="Value31" Message="value two3" Command="third value3"Confirm="y" />

<action From="Value41" Message="value two4" Command="third value4"Confirm="y" />

</IncomingActions>
.

Jul 21 '05 #4
so there is no way to make this with the usual config stuff.... for the
other i have already my own xml-config reader, for complexer settings, but
okay, thanks for that hint
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us>
schrieb im Newsbeitrag news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi Patrick,

I would suggest you put those config settings in another XML file, so you
can parse it and create a collection ( or maybe a Hashtable ) to contain
them.
You can create a class Config with a static constructor ( to be sure it will be called before you use this class ) from where you load/parse the config.
Then you can have properties ( I suggest static too ) that you have access to the settings.
Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Patrick" <pa********@bluemail.ch> wrote in message
news:10***************@fuchs.cyberlink.ch...
Hi

I want tu use an app.config like the example below. The problem is, that i don't know how many Action-Tags there will be, because this can be changed by the user. When using

System.Configuration.ConfigurationSettings.GetConf ig("IncomingActions/action
") I can access the config file, but get only the values of the Last
Action-Tag.
Does someone know, how to implement that using the app.config file?

Thanks

Patrick

<configSections>

<sectionGroup name="IncomingActions">

<section name="action"
type="System.Configuration.SingleTagSectionHandler " />

</sectionGroup>

</configSections>

<IncomingActions>

<action From="Value11" Message="value two1" Command="third value1"
Confirm="y" />

<action From="Value21" Message="value two2" Command="third value2"
Confirm="y" />

<action From="Value31" Message="value two3" Command="third value3"
Confirm="y" />

<action From="Value41" Message="value two4" Command="third value4"
Confirm="y" />

</IncomingActions>


Jul 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Koray Atsan | last post by:
Hi All I have a simple question as i am a newbie in xml. I am using XmlTextWriter to write some values to an xml file . I use XmlTextWriter textwriter = new XmlTextWriter ("path",null); to create...
0
by: Hrvoje Voda | last post by:
How to read more then one value into checked listbox? I would like to read UserID and UserName, but in listbox I would like to show only UserName. Is that possible? I need UserID to Update it...
2
by: sivashankar | last post by:
hi experts -In asp.net i'm having form1 and form2. -Form :1 -I'm posting data by following code: Response.Redirect("WEBFORM2.ASPX?A=" & TextBox1.Text) Response.Redirect("WEBFORM2.ASPX?B=" &...
4
by: Patrick | last post by:
Hi I want tu use an app.config like the example below. The problem is, that i don't know how many Action-Tags there will be, because this can be changed by the user. When using...
3
by: cuneyt | last post by:
Hi I am working on a class that reads parameter values from a configuration file and inserts them into a hash. There are many good dimplementations of this on the Web. What I would like to do,...
3
by: artev | last post by:
if inner a form I have : foreach ($arrayquery as $a) { echo <input type="hidden" name="x1" value=" $a->type" >; echo <input type="hidden" name="x2" value=" $a->color" >; echo <input...
12
bartonc
by: bartonc | last post by:
For those of you who have never used the *listofargs and **dictofargs syntax, here is a look at the latter. By using **kwargs, a dictionary of any size is sent into the fuction as dict(a=1, b=2)....
7
by: group256 | last post by:
Hi guys I just want to know how I can return more than one value in a function. For example I send tow integers to my function and then I do some operation on them then I want to send them back...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.