I have created a class library in VB .NET. Some code in the library connects to the database. I want to create a config file that would hold the connection string.
I have created a "Settings.settings" file and stored the connection string in there.
When a class library having a settings file is built, it generates a ".dll.config" file which has the key value pairs defined in the settings file.
Problem with this is when i change the connection string in the ".dll.config" file, the library does not references these changes. I would still need to recompile the class library which would then overwrite my changes in the .dll.config file.
I need to be able to change the connection strings on the fly without having to recompile the library.
Is there a mechanism in VB.NET class library (.NET 2.0) that would let me do this?
Passing the connection string to the class library from the web page that uses its method is not a option.
I have listed a sample below, this is how i would access the string.
Public Function getsettings(ByVal Setting As String) As String If Setting = "Demo" Then Return My.Settings.Demo Else Return My.Settings.Live End If End Function