title: Cannot change the connectionstring with Entity Framework 4.1 code first
body: <p>I am having trouble changing the connection string used by entity framework code first for my project.  I created a MVC3 project and then added two projects, DomainClasses and DataAccess.</p>
  
  <p>The DomainClasses project has one class file named Classes.cs with one class:</p>
  
  <pre><code>public class User
  {
      public int ID { get; set; }
      public string Username { get; set; }
      public string EmailAddress { get; set; }
      public string Password { get; set; }
      public int StatusID { get; set; }
      public DateTime DateCreated { get; set; }
  }
  </code></pre>
  
  <p>The DataAccess project has one class file named PLNQDB.cs with one class:</p>
  
  <pre><code>public class PLNQDB : DbContext
  {
      public DbSet&lt;User&gt; Users { get; set; }
  }
  </code></pre>
  
  <p>I have a reference to each of these projects inmy MVC project and everything builds fine and runs and even creates the database file that I am able to save to and retrieve data from.</p>
  
  <p>When running the project I can see in the Autos window the connection string being used under this.db.base.Database.Connection.base.ConnectionString =</p>
  
  <pre><code>"Data Source=.\\SQLEXPRESS;Initial Catalog=PLNQ.DataAccess.PLNQDB;Integrated Security=True;MultipleActiveResultSets=True"
  </code></pre>
  
  <p>My question is how do I override this autogenerated connectionstring to use my remote server.  I have added a connection string to the web.config file of the MVC project.</p>
  
  <pre><code>  &lt;connectionStrings&gt;
      &lt;add name="ApplicationServices"
           connectionString="Data Source=255.255.255.255;Initial Catalog=PLNQ;User ID=blah;Password=blah"
           providerName="System.Data.SqlClient" /&gt;
    &lt;/connectionStrings&gt;
  </code></pre>
  
  <p>but everytime I run the project it still uses the auto generated connectionstring.  I have also tried adding App.config files with the same connection string in both the DataAccess and DomainClasses projects.</p>
  
  <p>What am I missing?</p>