title: Forcing code-first to always initialize a non-existent database?
body: <p>Sometimes, I'll delete my development database and run my EF code-first application.  I'll get the error:</p>
  
  <blockquote>
    <p>Cannot open database "AssessmentSystem" requested by the login. The login failed.
    Login failed for user 'AssessmentAdmin'.</p>
  </blockquote>
  
  <p>I think this is because the <code>DbContext</code> only runs the DB initialization logic "once per AppDomain when the context is used for the first time", as <a href="http://www.codeguru.com/csharp/article.php/c19999/Understanding-Database-Initializers-in-Entity-Framework-Code-First.htm" rel="noreferrer">this page</a> says.  This means I need to recycle the IIS application pool to get EF to recreate my database if I drop it.</p>
  
  <p>Is there any way I can get the DB initialization code to run <em>every time</em> I try to access the database?  So, it will always check to see whether the DB exists and if not, create it instead of trying to open it, even if it's using the same AppDomain that previously accessed the database that I have now dropped?</p>
  
  <p>Note that I would like this initializtion check to be done on <em>every query</em>, so even having it done in <code>Application_Start</code> isn't often enough; ideally, I'd like to be able to load some DB data, delete the DB, then load some DB data and it would recreate the DB without my even having to restart the application (basically I would just have to reload the web page that loads some DB data).</p>