I have a DLL library Configuration
in my solution and many applications call this library. This library needs the connection string to the database. Instead of storing the connection string in all applications I wanted to store it once in the DLL Configuration
.
As a solution it was proposed to store it in the properties of the DLL Library Configuration
. Thus, I save it there and read it with the following function:
public string ConnString()
{
return Properties.Settings.Default.ConnectionString;
}
In the calling applications I call successfully this function:
Dim d as new Configuration.ConfigurationRepository("")
msgbox(d.ConnString())
But now I want to change the value in the value in the DLL and thus change the value in the Configuration.dll.config
. But when I run the applications they get the old value of Configuration
and don't update to get the new value which has been set manually. Just if I go in the project Configuration
and go to Properties, then I get a message box the value has been changed and if I want to update. Then just if now I agree to update and run an application again, I get the updated value.
The Configuration.dll.config
looks like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="Configuration.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup><applicationSettings>
<Configuration.Properties.Settings>
<setting name="ConnectionString" serializeAs="String">
<value>werwrwerwre</value>
</setting>
</Configuration.Properties.Settings>
</applicationSettings>
</configuration>
How can I get the updated connection string in the config file from the DLL Configuration
?