473,800 Members | 2,930 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

configuration element and collection

Hi,

I am doing some complex configuration handling, and I have similiar setup:

<DataSchema version="1.0">
<modules name="Assets">
<tables>
<tables description="" singular="" plural="" name="City" />
</tables>
</modules>
<modules name="Assets2">
<tables>
<tables description="" singular="" plural="" name="City" />
</tables>
</modules>
</DataSchema>

it goes deeper but it's not the point, I'd like to find out the module from
table element.
in collections I have defined following indexer:
new public ElementType this[string name]
{
get { return ( ElementType )base.BaseGet(n ame); }
}
which returns correct element, like this:
Module m1 = section.Modules["Assets"];
Module m2 = section.Modules["Assets2"];
Table t1 = m1.Tables["City"];
Table t2 = m2.Tables["City"];

so far so good, however I'd like to get the siblings, or collection from
element:
Module m = table.ParentCol lection.Parent;
TablesCollectio n tc = table.ParentCol lection;

since this is quite easily human readable, I can't see a reason of this not
beeing possible, and yet, I can't find an apropraite method, to use or
overload from ConfigurationEl ement

Anyone?

CUIN Kaczy
Dec 12 '05 #1
1 3604
OK, unless it's obvious, forget it.
I did what I need in TablesCollectio n, thus I had the access to all Table
siblings.
From design POV it is even better, to have parent setup all his children
properly.

CUIN Kaczy

Użytkownik "Andrzej Kaczmarczyk" <ak**********@v isualsystems.co m.pl> napisał
w wiadomo¶ci news:%2******** *******@TK2MSFT NGP10.phx.gbl.. .
Hi,

I am doing some complex configuration handling, and I have similiar setup:

<DataSchema version="1.0">
<modules name="Assets">
<tables>
<tables description="" singular="" plural="" name="City" />
</tables>
</modules>
<modules name="Assets2">
<tables>
<tables description="" singular="" plural="" name="City" />
</tables>
</modules>
</DataSchema>

it goes deeper but it's not the point, I'd like to find out the module
from table element.
in collections I have defined following indexer:
new public ElementType this[string name]
{
get { return ( ElementType )base.BaseGet(n ame); }
}
which returns correct element, like this:
Module m1 = section.Modules["Assets"];
Module m2 = section.Modules["Assets2"];
Table t1 = m1.Tables["City"];
Table t2 = m2.Tables["City"];

so far so good, however I'd like to get the siblings, or collection from
element:
Module m = table.ParentCol lection.Parent;
TablesCollectio n tc = table.ParentCol lection;

since this is quite easily human readable, I can't see a reason of this
not beeing possible, and yet, I can't find an apropraite method, to use or
overload from ConfigurationEl ement

Anyone?

CUIN Kaczy

Dec 12 '05 #2

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

Similar topics

3
1926
by: Robert | last post by:
I have an application with custom configuration sections in it's app.config file. Here's a shortened excerpt: <monitors> <monitor type="SystemMonitor.Monitors.NetworkAvailabilityMonitor,SystemMonitor"> <notifiers> <notifier type="SystemMonitor.Notifiers.MessageBoxNotifier,SystemMonitor" />
3
2883
by: Florida Coder | last post by:
I have the need to store some application specific configuration data to be used by a class library and or a windows service. I would like to do this in a fashion similar to the way we do with applications and web services without having to use the machine.config file. I know that I could use the code below to do this but the problem then becomes that when using a shared assembly both the assembly and the config file need to be put...
2
4136
by: gcrasher | last post by:
What is the easiest way to store a collection of strings using the MS Configuration Block? I am using XML serializer. I tried having an ArrayList as a property in the class I was serializing, but when it is read back it is no longer an arraylist of string values. Any ideas?
5
4603
by: Water Cooler v2 | last post by:
I know that we can add a single name value entry in app.config or web.config in the configuration/configSettings/appSettings section like so: <add key="key" value="value" /> Question: I want to add a dictionary of name-value pairs. In other words, instead of a single name-value, I want to add a name-value collection in there. I could do this:
4
1918
by: Michael Lang | last post by:
I was basically wanting to know how to use the System.Configuration namespace to be able to load an arbitrary number of unknown attributes on an element in a custom section in the .config into a NameValueCollection. Basically I want to do something similiar to what occurs with a System.Configuration.Provider.ProviderBase Initialise method - the provider is passed a NameValueCollection containing attribute names and their associated...
1
1785
by: =?Utf-8?B?RGljaw==?= | last post by:
My Windows Application stores its configuration values in app.config and these are typed and accessed via corresponding classes, something like this... <configSections> <section name="Watcher"/> </configSections> <Watcher> <ClockWatcherCollection> <add Name="Blah"/>
0
1129
by: michael1778 | last post by:
I have having trouble to get the following code (related to custom configuration .net 2.0) to work. Can anyone please help? Custom config file: <?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <section name="Config" type="LibRefresh.Config, LibRefresh" /> <section name="WebApplicationLists" type="LibRefresh.CustomConfigSection, LibRefresh" /> </configSections>
4
2699
balabaster
by: balabaster | last post by:
Okay, I decided that I needed to understand the whole custom configuration file bits and so I've spent some time playing around with it. It seems (in the most) relatively straight forward. However, I've come unstuck with one scenario that I'm trying to figure out the code for: Consider the following configuration: <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="DummySection"...
0
9689
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10495
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10269
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10248
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10032
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5469
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4148
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.