title: How to implement IDbContextFactory for use with Entity Framework data migrations
body: <p>I am trying to use Entity Framework data migrations, as described in <a href="http://blogs.msdn.com/b/adonet/archive/2012/02/09/ef-4-3-code-based-migrations-walkthrough.aspx" rel="noreferrer">this post</a>.</p>
  
  <p>However, when I try to execute the <code>Enable-Migrations</code> step, I receive the following error in Package Manager Console:</p>
  
  <pre><code>The target context 'MyDataContext' is not constructible. Add a default constructor or provide an implementation of IDbContextFactory
  </code></pre>
  
  <p>So, I created a factory class that implements <code>IDbContextFactory</code> in the project that contains my <code>DbContext</code> class, but data migrations doesn't appear to recognize it.</p>
  
  <p>Is there something that I should explicitly do to instruct data migrations to use this factory class?</p>