title: Connection string EF 4.1 code first SQL compact in windows form application
body: <p>I have created a windows form application:</p>
  
  <ol>
  <li>A presentation library with several windows forms</li>
  <li>A class library with a data layer</li>
  <li>A class library to access a database</li>
  </ol>
  
  <p>I'm using EntityFramework 4.1 with Code First Approach and SQL Compact 4.0 database.</p>
  
  <p>I created a connection string in the app.config file in the class library project used to connect to the database. The problem is that the connection string has apparently no influence on the database creation. I mean that everything is working fine with the program but even if I specify a location for the database this does not have any effect!</p>
  
  <p>Am I writing in the right app.config?
  Do I need to initialize my DbContext class in a specific way? (today I do not pass any connection string in the constructor)</p>
  
  <p><strong>DbContext class:</strong></p>
  
  <pre><code>public class MyDB : DbContext
  {
      public DbSet&lt;ContactPerson&gt; ContactPersons { get; set; }
  
      public DbSet&lt;Customer&gt; Customers { get; set; }
  
      public DbSet&lt;Project&gt; Projects { get; set; }
  
      public DbSet&lt;Quotation&gt; Quotations { get; set; }
  
      public MyDB()
      : base("MyDatabase")
      {
  
      }
  }
  </code></pre>
  
  <p><strong>App.config connection string:</strong></p>
  
  <pre><code>&lt;add name="MyDatabase" connectionString="Data Source=MyDB.sdf" 
  providerName="System.Data.SqlServerCE.4.0"&gt;
  </code></pre>