title: What is preferred method for modifying connection string settings in DAL class library when deploying asp.net web app?
body: <p>I deployed my asp.net web app project that has a reference to my DAL class library. How can I change the connection string in my DAL library once deployed? The DAL code was ignoring my web.config connection string and trying to use the app.config value. </p>
  
  <p>I thought I would be able to edit a config file that is associated with the class library, but I can't find one. Temporarily I edited the connection string and re-compiled and re-deployed the library. </p>
  
  <p>Is there an option or way to setup the project files where it changes the values of the connection string based on being compiled in debug mode versus doing a release compile.
  What is the recommended way of dealing with connection strings in web apps which reference class libraries?</p>
  
  <p>Clarification: 
  the DAL library connection strings are also utilized by some datasets and L2S classes (.dbml) and I am not sure how to change those to reference a web.config file that sits outside the library in the web app project. </p>
  
  <p>Currently Using this code to get around my L2S class problem:</p>
  
  <pre><code>public partial class MyDataContext 
  {
      partial void OnCreated()
      {
  
          ConnectionStringSettings cs = ConfigurationManager.ConnectionStrings["PrimaryConnectionString"];
  
          if (cs != null)
          {
              this.Connection.ConnectionString = cs.ConnectionString;
          }
      }
  }
  </code></pre>