Hi, I want to read configurationfiles from other applications, so I tried this example out. And the result puzzles me.
I've changed the filename 'ConfigurationManager_CS.config' into 'Interface.dll.config'.
This is my configuration file 'Interface.dll.config' (one connectionstring and one parameter) :
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="SomeInterface.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<connectionStrings>
<add name="SomeInterface.Properties.Settings.MyDBConnectionString"
connectionString="Data Source=localhost;Initial Catalog=B_TEST;MultipleActiveResultSets=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<applicationSettings>
<SomeInterface.Properties.Settings>
<setting name="SetDownloadFlag" serializeAs="Bool">
<value>True</value>
</setting>
</SomeInterface.Properties.Settings>
</applicationSettings>
</configuration>
This is the output from the sample :
Using OpenExeConfiguration(ConfigurationUserLevel).
Show appSettings section elements:
#0 Key: NewKey0 Value: zondag 30 november 2008 23:00:33
Using AppSettings property.
Show appSettings section elements:
#0 Key: NewKey0 Value: zondag 30 november 2008 23:00:33
Using OpenExeConfiguration(string).
Show sections in the configuration file:
Name: system.data
Name: windows
Name: system.webServer
Name: mscorlib
Name: system.data.oledb
Name: system.data.oracleclient
Name: system.data.sqlclient
Name: configProtectedData
Name: satelliteassemblies
Name: system.data.dataset
Name: startup
Name: system.data.odbc
Name: system.diagnostics
Name: runtime
Name: system.codedom
Name: system.runtime.remoting
Name: connectionStrings
Name: assemblyBinding
Name: appSettings
Name: system.windows.forms
Using ConnectionStrings property.
Connection strings:
Name: LocalSqlServer
Connection string: data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFi
lename=|DataDirectory|aspnetdb.mdf;User Instance=true
Provider: System.Data.SqlClient
Using GetSection(string).
AppSettings section XML:
<appSettings>
<add key="NewKey0" value="zondag 30 november 2008 23:00:33" />
</appSettings>
Using OpenMappedMachineConfiguration.
Sections in machine.config:
Name: system.data
Name: windows
Name: system.webServer
Name: mscorlib
Name: system.data.oledb
Name: system.data.oracleclient
Name: system.data.sqlclient
Name: configProtectedData
Name: satelliteassemblies
Name: system.data.dataset
Name: startup
Name: system.data.odbc
Name: system.diagnostics
Name: runtime
Name: system.codedom
Name: system.runtime.remoting
Name: connectionStrings
Name: assemblyBinding
Name: appSettings
Name: system.windows.forms
Using OpenMappedExeConfiguration.
AppSettings section XML:
Using OpenMachineConfiguration.
Connection strings in machine.config:
Name: LocalSqlServer
Connection string: data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFi
lename=|DataDirectory|aspnetdb.mdf;User Instance=true
Provider: System.Data.SqlClient
This is not what I expected, I expected that the connectionstring and the parameter would be also outputted. Can anyone explain to me why this doesn't happen in this sample, and how this should be done?
Thanks, Gijs