title: Entity Framework code first: update SetInitializer throws exception
body: <p>I've been looking for this strange error for hours but haven't found anything. I have a very simple entity:</p>
  
  <pre><code>public class Company {
      public Guid Id { get; set; }
      public string Name { get; set; }
  }
  </code></pre>
  
  <p>And here is the context:</p>
  
  <pre><code>public class MyDBContext : DbContext {
  
      public DbSet&lt;Company&gt; Companies { get; set; }
  
  }
  </code></pre>
  
  <p>When running the first time, everything works just fine. But, when I change the entity (for example, I put the [Key] attribute for Id), I get the expected "model has changed" or something error. So, I enter this in the Global.asax application_start:</p>
  
  <pre><code>Database.SetInitializer&lt;MyDBContext&gt;
  (new DropCreateDatabaseIfModelChanges&lt; MyDBContext &gt;());
  </code></pre>
  
  <p>This is where I get stuck. There is no compile error, it compiles without errors / warnings. But, when I run my project, I get the following error:</p>
  
  <p>Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.</p>
  
  <p>Exception Details: <code>System.TypeLoadException: GenericArguments[0], 'MyDB.Data.MyDBContext', on 'System.Data.Entity.IDatabaseInitializer1[TContext]' violates the constraint of type parameter 'TContext'</code>.</p>
  
  <p>Please, does someone have a clue? I'm using Entity Framework 4.1 (CTP5)</p>