S
serge calderara
Dear all,
I have define a configuration file for my application with
different section groups and settings belonging to each
individual group like as follow :
=====================================================
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<!-- Definition of the User Management section -->
<sectionGroup name="UserManagement">
<section name="settings"
type="System.Configuration.NameValueSectionHandler" />
</sectionGroup>
<!-- Definition of the Configuration Mangement
section -->
<sectionGroup name="ConfigurationManagement">
<section name="settings"
type="System.Configuration.NameValueSectionHandler" />
<section name="database"
type="System.Configuration.NameValueSectionHandler" />
</sectionGroup>
<!-- Definition of the Language Management section -->
<sectionGroup name="LanguageManagement">
<section name="settings"
type="System.Configuration.NameValueSectionHandler" />
</sectionGroup>
<!-- Definition of the HMI builder Management section --<sectionGroup name="HMIBuilder">
<section name="settings"
type="System.Configuration.NameValueSectionHandler" />
</sectionGroup>
</configSections>
<!-- Definition of the User management assembly setting
Parameter define in this section are only used by
UserMangement -->
<UserManagement>
<settings>
<add key="LastLoginName"
value="calderara" />
<add key="RememberEntry" value="1" />
</settings>
</UserManagement>
<!-- Definition of the Configuration management
assembly setting
Parameter define in this section are only used by
UserMangement -->
<ConfigurationManagement>
<settings>
<add key="ConfigSaved" value="yes" />
<add key="AccessProviderDNS"
value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" />
</settings>
<database>
<add key="Path" value="E:\Configuration data
base" />
<add key="DNS"
value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" />
<add key="sqlserver" value="true" />
</database>
</ConfigurationManagement>
<!-- Definition of the Language management assembly setting
Parameter define in this section are only used by
UserMangement -->
<LanguageManagement>
<settings>
<add key="Default" value="English" />
</settings>
</LanguageManagement>
<!-- Definition of the HMI builder assembly setting
Parameter define in this section are only used by
UserMangement -->
<HMIBuilder>
<settings>
<add key="XPos" value="100" />
</settings>
</HMIBuilder>
<!-- Definition of the application setting
Find here any parameters for the global application
startup phase
key : represent the name of the key to scan
value: represent the actual value of the found key --<appSettings>
<add key="LogFile" value="TraceLog.txt" />
<add key="LogFilePath" value="C:" />
</appSettings>
<!-- Definition of the tracing operation
bActivate : Set tracing to ON or OFF (1=ON, 0=OFF)
TraceSeverity : define what type of message level
should be trace based
on TraceLevel (none, info, warning,fatal, verbose =
0,1,2,3,4)
Note that a value of 3 will trace also level 1 and
2 -->
<system.diagnostics>
<switches>
<add name="Enabled" value="1" />
<add name="TraceSeverity" value="1" />
</switches>
</system.diagnostics>
</configuration>
What is the best way to access and return those different
settings ?
Should I go with ConfigurationSettings class or use of
XMLDocument class ?
If A request is send to retrive parameter for a group I
should be able to rertreve all entry at once even if it
has different section.
thanks for your comments
regards
I have define a configuration file for my application with
different section groups and settings belonging to each
individual group like as follow :
=====================================================
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<!-- Definition of the User Management section -->
<sectionGroup name="UserManagement">
<section name="settings"
type="System.Configuration.NameValueSectionHandler" />
</sectionGroup>
<!-- Definition of the Configuration Mangement
section -->
<sectionGroup name="ConfigurationManagement">
<section name="settings"
type="System.Configuration.NameValueSectionHandler" />
<section name="database"
type="System.Configuration.NameValueSectionHandler" />
</sectionGroup>
<!-- Definition of the Language Management section -->
<sectionGroup name="LanguageManagement">
<section name="settings"
type="System.Configuration.NameValueSectionHandler" />
</sectionGroup>
<!-- Definition of the HMI builder Management section --<sectionGroup name="HMIBuilder">
<section name="settings"
type="System.Configuration.NameValueSectionHandler" />
</sectionGroup>
</configSections>
<!-- Definition of the User management assembly setting
Parameter define in this section are only used by
UserMangement -->
<UserManagement>
<settings>
<add key="LastLoginName"
value="calderara" />
<add key="RememberEntry" value="1" />
</settings>
</UserManagement>
<!-- Definition of the Configuration management
assembly setting
Parameter define in this section are only used by
UserMangement -->
<ConfigurationManagement>
<settings>
<add key="ConfigSaved" value="yes" />
<add key="AccessProviderDNS"
value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" />
</settings>
<database>
<add key="Path" value="E:\Configuration data
base" />
<add key="DNS"
value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" />
<add key="sqlserver" value="true" />
</database>
</ConfigurationManagement>
<!-- Definition of the Language management assembly setting
Parameter define in this section are only used by
UserMangement -->
<LanguageManagement>
<settings>
<add key="Default" value="English" />
</settings>
</LanguageManagement>
<!-- Definition of the HMI builder assembly setting
Parameter define in this section are only used by
UserMangement -->
<HMIBuilder>
<settings>
<add key="XPos" value="100" />
</settings>
</HMIBuilder>
<!-- Definition of the application setting
Find here any parameters for the global application
startup phase
key : represent the name of the key to scan
value: represent the actual value of the found key --<appSettings>
<add key="LogFile" value="TraceLog.txt" />
<add key="LogFilePath" value="C:" />
</appSettings>
<!-- Definition of the tracing operation
bActivate : Set tracing to ON or OFF (1=ON, 0=OFF)
TraceSeverity : define what type of message level
should be trace based
on TraceLevel (none, info, warning,fatal, verbose =
0,1,2,3,4)
Note that a value of 3 will trace also level 1 and
2 -->
<system.diagnostics>
<switches>
<add name="Enabled" value="1" />
<add name="TraceSeverity" value="1" />
</switches>
</system.diagnostics>
</configuration>
What is the best way to access and return those different
settings ?
Should I go with ConfigurationSettings class or use of
XMLDocument class ?
If A request is send to retrive parameter for a group I
should be able to rertreve all entry at once even if it
has different section.
thanks for your comments
regards