I deployed an asp.net web application project that has a link to my DAL class library. How do I change the connection string in my DAL after deploying it? The DAL code ignored my web.config connection string and tried to use the app.config value.
I thought I could edit the configuration file associated with the class library, but I could not find it. I temporarily edited the connection string and recompiled and redeployed the library.
Is there a way or way to configure project files where it changes the connection string values ββbased on compilation in debug mode compared to performing compilation with the release. What is the recommended way to work with connection strings in web applications that reference class libraries?
Explanation: DAL library connection strings are also used by some datasets and L2S classes (.dbml), and I'm not sure how to change them to refer to the web.config file that is outside the library in the web application project.
Currently using this code to get around the L2S class problem:
public partial class MyDataContext { partial void OnCreated() { ConnectionStringSettings cs = ConfigurationManager.ConnectionStrings["PrimaryConnectionString"]; if (cs != null) { this.Connection.ConnectionString = cs.ConnectionString; } } }
Breadtruck
source share