title: EntityFramework code-first custom connection string and migrations
body: <p>When I create a context with a default connection string (as read from the <code>app.config</code>) the database is created and the migrations work - basically everything is in order. Whereas when the connection string is created programatically (using <code>SqlConnectionStringBuilder</code>):</p>
  
  <ul>
  <li>database isn't created when the database is not present (scenario <code>A</code>);</li>
  <li><code>CreateDbIfNotExists()</code> creates the <em>newest</em> version of database model but the migration mechanisms are <em>not</em> invoked (scenario <code>B</code>).</li>
  </ul>
  
  <p>In <code>A</code> an exception is thrown when I wish to access the database, as - obviously - it isn't there. In <code>B</code> database is created properly migration mechanisms are <em>not</em> called, as is the case in standard connection string.</p>
  
  <p><strong>app.config</strong>:
  "<code>Data Source=localhost\\SQLEXPRESS;Initial Catalog=Db13;User ID=xxx;Password=xxx</code>"</p>
  
  <p><strong>builder</strong>:</p>
  
  <pre><code>sqlBuilder.DataSource = x.DbHost;
  sqlBuilder.InitialCatalog = x.DbName;
  sqlBuilder.UserID = x.DbUser;
  sqlBuilder.Password = x.DbPassword;
  </code></pre>
  
  <p><strong>initializer</strong>:</p>
  
  <pre><code>Database.SetInitializer(
      new MigrateDatabaseToLatestVersion&lt;
          MyContext,
          Migrations.Configuration
      &gt;()
  );
  </code></pre>
  
  <p><strong>Specs</strong>:
  Entity Framework: 5.0, DB: SQL Server Express 2008</p>