title: Entity Framework 7 Migration Scaffolding in Class Library with Configuration
body: <p>Trying to add migrations to an EF7 Model that lives in an ASP.NET 5 class library. When running <code>dnx . ef migration add mymigration</code> fails with different results depending on which project I run it on. </p>
  
  <p>If I run it in the folder of the main project, it cannot locate a <code>DbContext</code>, this makes sense because the <code>DbContext</code> is in the shared project and ef commands likely don't care about dependencies.</p>
  
  <p>If I run it in the folder of the shared project, it does not have access to the connection string specified in the startup.cs. I have gleaned from questions like <a href="https://stackoverflow.com/questions/30786505/cannot-run-migration-on-entity-framework-7-beta4-in-class-library-package">this</a> that it does work from the shared project if you specify the connection string in the <code>OnConfiguring</code> method of the <code>DbContext</code> but I really would like to keep this code separate from the configuration.</p>
  
  <p>I came across some <a href="https://github.com/aspnet/EntityFramework/issues/823" rel="nofollow noreferrer">issue logs</a> in the EF7 repository that mention they implemented command line options for specifying a project and a context but there are no examples and I couldn't figure out how to use it from looking at the source code in the commit history.</p>