title: How to initialize database with Entity Framework and Membership tables
body: <p>I have a MVC4 web application that use Entity Framework 5.0 Code First.</p>
  
  <p>In Global.asax.cs I have a bootstrapper that initialize the Entity.Database, force the database to be initialized and initialize the database for the Membership. The code is this one:</p>
  
  <pre><code>System.Data.Entity.Database.SetInitializer(new DatabaseContextInitializer());
  Database.Initialize(true);
  WebSecurity.InitializeDatabaseConnection(DEFAULTCONNECTION, "UserProfile", "UserId", "UserName", autoCreateTables: true);
  </code></pre>
  
  <p>The DatabaseContextInitializer is very simple for the moment:</p>
  
  <pre><code>public class DatabaseContextInitializer : DropCreateDatabaseIfModelChanges&lt;DatabaseContext&gt;
  {
      protected override void Seed(DatabaseContext dbContext)
      {
          base.Seed(dbContext);
          db.Set&lt;Workout&gt;().Add(new Workout {Id = 1, Name = "My First workout user1"})
  
      }
  }
  </code></pre>
  
  <p>The problem is that I cannot create User to the membership with:</p>
  
  <pre><code>WebSecurity.InitializeDatabaseConnection(DEFAULTCONNECTION, "UserProfile", "UserId", "UserName", autoCreateTables: true);
  </code></pre>
  
  <p>Because I have a problem with that the database is not created. How do you initialize some default user for your database with Entity Framework 5.0 and Asp.Net MVC 4?</p>