473,775 Members | 2,592 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating A Configuration Settings Object

Apr 9 '07 #1
4 3619
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
comfigurationSe ction in a declarative way.

#How to: Create Custom Configuration Sections Using ConfigurationSe ction
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 IConfigurationS ectionHandler interface:

#How to: Create Custom Configuration Sections Using
IConfigurationS ectionHandler
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.Set ting1
My.Settings.Set ting2
My.Settings.Cat egory1.Setting1
My.Settings.Cat egory2.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.comw rote in message
news:jD******** ******@TK2MSFTN GHUB02.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
comfigurationSe ction in a declarative way.

#How to: Create Custom Configuration Sections Using ConfigurationSe ction
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 IConfigurationS ectionHandler interface:

#How to: Create Custom Configuration Sections Using
IConfigurationS ectionHandler
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 <configurationr oot
* 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.Cat egory2.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
ConfigurationEl ement 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
2770
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 like: ================================================ <?xml version="1.0" encoding="utf-8" ?>
4
1647
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 for things such as Database Connection and other aspects. But when we use this file and try to access it using Properties.Settings.Default....., we get an object error. If this is possible: what are we doing wrong?
7
3310
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 many different dataGridViews to display data, and many of them have 10-20 columns (the actual number of displayed columns is user/client controlled, and in a couple cases could be ~30). The client would like to be able to resize the columns...
8
10222
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
1875
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 my xml configuration file? I can't integrate the settings in web.config, it has to be a seperate file. Kind Regards, Allan Ebdrup
2
2790
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: Imports System.Configuration Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
8
16097
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 which modifies Application setting section but how to add new item to userSettings ? Andrus.
1
1632
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 attribute-centric (mostly out of preference). For example... <Date> <Year>2008</Year>
0
2623
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 ExeConfigurationFileMap();
0
9622
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
10107
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
10048
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
9916
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...
1
7464
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5360
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...
0
5486
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4017
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
3
2853
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.