473,378 Members | 1,434 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,378 software developers and data experts.

Complex app.config setting

Hi !

I understand that dotNet offers app.config to store application
configuration as below:

<configuration>
<appSetting>
<add key="MySettingKey1" value="MySettingValue1" />
<add key="MySettingKey2" value="MySettingValue2" />
</appSetting>
</configuration>

But this type of configuration is too flat. I want to have something
like this:

<configuration>
<appSetting>
<add key="MySettingKey1" value="MySettingValue1" />
<subElement1>A</subElement1>
<subElement2>B</subElement2>
</add>
</appSetting>
</configuration>

How could this read this using ConfigurationSetting class ?

Thanks

Bob
Nov 22 '05 #1
6 2151
Create as key value pairs and parse. Under 2.0 you have other options, but
today it is done like so:

<configuration>
<appSetting>
<add key="MySettingKey1" value="key=X;Sub1=Y;Sub2=Z" />
</appSetting>
</configuration>

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
"wuji" wrote:
Hi !

I understand that dotNet offers app.config to store application
configuration as below:

<configuration>
<appSetting>
<add key="MySettingKey1" value="MySettingValue1" />
<add key="MySettingKey2" value="MySettingValue2" />
</appSetting>
</configuration>

But this type of configuration is too flat. I want to have something
like this:

<configuration>
<appSetting>
<add key="MySettingKey1" value="MySettingValue1" />
<subElement1>A</subElement1>
<subElement2>B</subElement2>
</add>
</appSetting>
</configuration>

How could this read this using ConfigurationSetting class ?

Thanks

Bob

Nov 22 '05 #2
Create as key value pairs and parse. Under 2.0 you have other options, but
today it is done like so:

<configuration>
<appSetting>
<add key="MySettingKey1" value="key=X;Sub1=Y;Sub2=Z" />
</appSetting>
</configuration>

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
"wuji" wrote:
Hi !

I understand that dotNet offers app.config to store application
configuration as below:

<configuration>
<appSetting>
<add key="MySettingKey1" value="MySettingValue1" />
<add key="MySettingKey2" value="MySettingValue2" />
</appSetting>
</configuration>

But this type of configuration is too flat. I want to have something
like this:

<configuration>
<appSetting>
<add key="MySettingKey1" value="MySettingValue1" />
<subElement1>A</subElement1>
<subElement2>B</subElement2>
</add>
</appSetting>
</configuration>

How could this read this using ConfigurationSetting class ?

Thanks

Bob

Nov 22 '05 #3
As an alternative, what I have done is to create a class that models my
settings structure and then just serialize and deserialize the class to
an xml file.

Nov 22 '05 #4
As an alternative, what I have done is to create a class that models my
settings structure and then just serialize and deserialize the class to
an xml file.

Nov 22 '05 #5
"Chris Dunaway" <du******@gmail.com> wrote in news:1119045470.454569.12900
@o13g2000cwo.googlegroups.com:
As an alternative, what I have done is to create a class that models my
settings structure and then just serialize and deserialize the class to
an xml file.


You may find this even easier:
http://tinyurl.com/97nzb
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Make your ASP.NET applications run faster
http://www.atozed.com/IntraWeb/
Nov 22 '05 #6
"Chris Dunaway" <du******@gmail.com> wrote in news:1119045470.454569.12900
@o13g2000cwo.googlegroups.com:
As an alternative, what I have done is to create a class that models my
settings structure and then just serialize and deserialize the class to
an xml file.


You may find this even easier:
http://tinyurl.com/97nzb
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Make your ASP.NET applications run faster
http://www.atozed.com/IntraWeb/
Nov 22 '05 #7

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

Similar topics

2
by: Max Metral | last post by:
I'm trying to set the default behavior of customErrors in the machine.config. The documentation seems to suggest this should work, but it doesn't seem to work for me. On my development machine, I...
12
by: Ben | last post by:
I have a group of settings that I'd like to have inherited by multiple sites. I'm trying this, but it's not working. wwwroot\group\web.config wwwroot\group\site1\web.config...
5
by: Keith | last post by:
Hello all, I have a C# Windows Forms app. It is in namespace App.GUI. It builds to Nav.exe. I have entered an application level setting using the designer. Its type is string, name is "FOO"...
5
by: mmcd79 | last post by:
I built a VB.net application that makes use of a machine level DB connection string setting, and a user level starting location setting. The machine level setting and the default user based...
9
by: antonyliu2002 | last post by:
By default, IIS is configured to timeout a session in 20 minutes, which can be changed through the IIS config window. I use InProc sessionState mode. I can also set the session timeout in...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.