title: Dependency Injection into Entity Framework seed method?
body: <p>Is it possible to inject dependencies into Configuration class of Entity Framework 6?</p>
  
  <p>For example, like this:</p>
  
  <pre><code>internal sealed class Configuration : DbMigrationsConfiguration&lt;MyBaseContext&gt;
  {
      private readonly ILogger _logger;
  
      public Configuration(ILogger logger)
      {
          this._logger = logger;
          AutomaticMigrationsEnabled = true;
      }
  
      protected override void Seed(Home.DAL.Data.HomeBaseContext context)
      {
           //log something
      }
  }
  </code></pre>
  
  <p>Or more general approach is to obtain possibility to inject code even inside migrations:</p>
  
  <pre><code>public partial class InitialMigration : DbMigration
  {        
      private readonly ILogger _logger;
  
      public InitialMigration(ILogger logger)
      {            
           this._logger = logger;
      }
  
      public override void Up()
      {
          CreateTable(...);
      }
  
      public override void Down()
      {
          DropTable(...);
      }
  }
  </code></pre>
  
  <p>Where is DI initialization happens in Entity Framework 6 to define those bindings?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Im not asking about what I should use. Currently, Im using Ninject but that's out of the question, because whatever I use, I should be able to inject dependecies into constructor of migrations. Of courser if you write something like I wrote in example above it will just throw you exception about "no default constructor". </p>
  
  <p>ILogger in above example is just simple example of dependency. Things go worse if you have IGeneratorService which will generate some data and you want to use this service to generate data for Seed method.</p>