title: MVC3 Code First, Cannot find Metadata
body: <p>I'm following a tutorial (<a href="http://weblogs.asp.net/scottgu/archive/2011/05/05/ef-code-first-and-data-scaffolding-with-the-asp-net-mvc-3-tools-update.aspx" rel="nofollow">http://weblogs.asp.net/scottgu/archive/2011/05/05/ef-code-first-and-data-scaffolding-with-the-asp-net-mvc-3-tools-update.aspx</a>) to build a simple MVC 3 web application. I'm using a code first methodology and things were going good until I had to go back and add a field onto one of my models. </p>
  
  <p>I got the error "Invalid column name 'Summary'." Which makes sense because this was the new field that I had added to the model.</p>
  
  <p>Its my understanding that whenever Visual Studio realizes that the existing DB is different from the one that it is connected to, Visual Studio will try to recreate the DB. This is the behavior that I want so I added the following line to my Application_start in my global.asax file.</p>
  
  <pre><code>Database.SetInitializer&lt;MyDBContext&gt;(new DropCreateDatabaseIfModelChanges&lt;MyDBContext&gt;());
  </code></pre>
  
  <p>Now when I try to run the program I get the error "Model compatibility cannot be checked because the database does not contain model metadata. Model compatibility can only be checked for databases created using Code First or Code First Migrations."</p>
  
  <p>I even deleted the existing database that I've been using so Visual Studio doesn't get confused. </p>
  
  <p>What do I need to do in order to get Visual Studio to nuke the DB every time I change the models? </p>