Where does ConfigurationManager ConnectionStrings get its value?
Date : March 29 2020, 07:55 AM
may help you . I figured out what was going wrong. So to answer my own question... ConfigurationManager only reads from web.config.
|
ConfigurationManager.ConnectionStrings.Add
Tag : chash , By : beebob
Date : March 29 2020, 07:55 AM
This might help you The app.config file is not supposed to be edited by the application. One way to tell that's the case is to think about where it is located - next to the executable file in a folder that (by default) is not writeable by the user or the user's apps (program files). I would say if it is something the user is modifying, it should be stored in settings.
|
Enterprise Library: Redirecting connectionStrings section does not add new ConnectionStrings to ConfigurationManager.Con
Tag : chash , By : joshski
Date : March 29 2020, 07:55 AM
help you fix your problem Actually, ConfigurationManager.ConnectionStrings does not know anything about Enterprise Library infrastructure. By default, sections cannot be redirected with Enterprise Library's ConfigurationSource. You should use configSource attribute, which is feature of .NET Framework, not Enterprise Library. <?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings configSource="sharedConnectionStrings.config" />
</configuration>
<?xml version="1.0" encoding="utf-8" ?>
<connectionsStrings>
<add name="connStr1"
connectionString="Data Source=local;Initial Catalog=DB1;Integrated Security=True"
providerName="System.Data.SqlClient" />
<add name="connStr2"
connectionString="Data Source=local;Initial Catalog=DB2;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionsStrings>
Database db = DatabaseFactory.CreateDatabase(“Tom’s Connection”);
|
How does ConfigurationManager.ConnectionStrings work?
Tag : chash , By : user143038
Date : March 29 2020, 07:55 AM
|
ConfigurationManager.ConnectionStrings(2).ConnectionString
Tag : .net , By : Gabriel
Date : March 29 2020, 07:55 AM
|