473,513 Members | 2,448 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating A Configuration Settings Object

Apr 9 '07 #1
4 3599
Hi J,

As for creating custom configuration section for .NET framework application
configuration file, you have two means according to the .net framework 2.0
configuration section handler interface:

1. Use the existing configuration classes to build your custom
comfigurationSection in a declarative way.

#How to: Create Custom Configuration Sections Using ConfigurationSection
http://msdn2.microsoft.com/en-us/library/2tw134k3.aspx

http://www.codeproject.com/dotnet/cu...ctionsNet2.asp
2. Using built-in classes may have few customzation ability such as control
the exact element name or collection section's child elements. thus, you
can also build a custom section through complete programmatic way by using
the IConfigurationSectionHandler interface:

#How to: Create Custom Configuration Sections Using
IConfigurationSectionHandler
http://msdn2.microsoft.com/en-us/library/ms228056.aspx

in this case, you will write all the code that do the xml reading/writing
for your custom section

Here is a list of all those .NET 2.0 configuration section classes you can
use:

#Classes Used to Create Custom Section Handlers
http://msdn2.microsoft.com/en-us/lib...62(vs.80).aspx

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.


Apr 10 '07 #3
For the most part, the built in stuff is working for me. The one thing that
i would like is to be able to have config sections within sections...

So I can reference settings like such:

My.Settings.Setting1
My.Settings.Setting2
My.Settings.Category1.Setting1
My.Settings.Category2.Setting2

Is there a way to have this sort of hierarchical settings configuration with
the built in stuff?

Thanks.

J
"Steven Cheng[MSFT]" <st*****@online.microsoft.comwrote in message
news:jD**************@TK2MSFTNGHUB02.phx.gbl...
Hi J,

As for creating custom configuration section for .NET framework
application
configuration file, you have two means according to the .net framework 2.0
configuration section handler interface:

1. Use the existing configuration classes to build your custom
comfigurationSection in a declarative way.

#How to: Create Custom Configuration Sections Using ConfigurationSection
http://msdn2.microsoft.com/en-us/library/2tw134k3.aspx

http://www.codeproject.com/dotnet/cu...ctionsNet2.asp
2. Using built-in classes may have few customzation ability such as
control
the exact element name or collection section's child elements. thus, you
can also build a custom section through complete programmatic way by using
the IConfigurationSectionHandler interface:

#How to: Create Custom Configuration Sections Using
IConfigurationSectionHandler
http://msdn2.microsoft.com/en-us/library/ms228056.aspx

in this case, you will write all the code that do the xml reading/writing
for your custom section

Here is a list of all those .NET 2.0 configuration section classes you can
use:

#Classes Used to Create Custom Section Handlers
http://msdn2.microsoft.com/en-us/lib...62(vs.80).aspx

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no
rights.


Apr 11 '07 #4
Thanks for your reply J,

As for the hierarchical setting you mentioned, here is my understanding:

the .NET framework configuration system can only support the following
section/group hierarchy:

* a certain section directly under the <configurationroot
* a certain section under a section group(like <system.web>) and other
sections nested under that section group

so far I haven't found any reference about nested sections in other
sections.

As for the My.Settings.Category2.Setting2 like section, one way to
achive this setting structure is a below:

* create a custom section, this is the "My"

* in "My" configuration section, define "Settings" as a sub property(of
ConfigurationElement derived type)

* in "Settings" configuration Element you define "Category2" as a sub
property

* in "Category2" configuration Element class, you define "Setting2" as a
sub property

How do you think?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Apr 13 '07 #5

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

Similar topics

1
2740
by: serge calderara | last post by:
dear all, I have problem accessing section group in my configuration application file. I got an error saying thta I can have only one section ???? here is my application configuration looks...
4
1635
by: Andy | last post by:
Is it possible to use a Settings / Configuration file in VS 2005 / .Net 2.0 in a dll? Or is this feature limited to an executable? We have some .dlls where a configuration file would be helpful...
7
3300
by: lord.zoltar | last post by:
I have a problem which I think can be solved by creating new Settings on the fly, but I'mnot sure if it's possible, or if a better solution may exists. Here's the situation: I have a project with...
8
10204
by: Alberto | last post by:
Can you tell me how to read and modify a value in the app.config file using this class? Thank you very much
5
1862
by: Allan Ebdrup | last post by:
I have a webservice in ASP.Net 2.0, I need to store and load a xml configuration file in relation to one of the web methods in my webservice. What's the best place to store and the best way to load...
2
2764
by: remya1000 | last post by:
i'm using VB.NET 2003. Last time while i did a program in Vb.Net 2005, i use "Configuration". and i could read and write to that XML configuration file like the example below. CODES:...
8
16084
by: Andrus | last post by:
..NET 2 Winforms application. How to create new setting and set it default value in userSettings section of app.config file or overwrite existing setting value ? I found code below in this list...
1
1610
by: =?Utf-8?B?SmFzb24gUmljaG1laWVy?= | last post by:
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...
0
2608
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= | last post by:
Hi, thanks, mister The code string rutaConfig = tbRutaConfigServicioBase.Text; '// Map to the application configuration file. ExeConfigurationFileMap configFile = New...
0
7265
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,...
0
7388
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
7545
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...
1
7111
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...
0
5692
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,...
1
5095
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
3228
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
461
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.