How do you configure the DbContext when creating Migrations in Entity Framework Core?

后端 未结 7 1303
时光取名叫无心
时光取名叫无心 2020-12-11 02:51

Is there way that dependency injection can be configured/bootstrapped when using Entity Framework\'s migration commands?

Entity Framework Core supports dependency in

7条回答
  •  星月不相逢
    2020-12-11 03:03

    I know this is a old question but I use the onConfiguring method and I don't have this problem

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        optionsBuilder.UseSqlServer(Startup.Configuration.Get("Data:DefaultConnection:ConnectionString"));
    }
    

提交回复
热议问题