title: How to Create LocalDB using CodeFirst if DB is Deleted?
body: <p>How can <code>EF5/CodeFirst</code> be used to re-create a <code>LocalDb</code> database if it is deleted from the file system?  </p>
  
  <p>All of the articles I have found discuss enabling migrations or running update-database. Which only pertain to design time.  </p>
  
  <p>I'm looking for a solution that can be used at runtime.</p>
  
  <p>I'm using <code>DropCreateDatabaseIfModelChanges</code> as a custom initializer and this works great during development and when the database is first created at runtime.  However, the database is never created a second time, for example; if a user deletes the <code>LocalDb</code> database from the file system.  </p>
  
  <p>I've tried manually creating the database and, although the files get created successfully, the <code>schema</code> is never generated (error is <code>"Model compatibility cannot be checked because the database does not contain model metadata."</code>).</p>
  
  <p>Thanks, in advance.</p>