c# - Enable-Migrations 已过时。使用 Add-Migration 开始使用迁移

标签 c# asp.net-mvc entity-framework asp.net-core entity-framework-core

好的,但是在配置过时之前我们使用的以下设置怎么样?

public Configuration()
{
    //AutomaticMigrationsEnabled = true; //it is Ok for now as default value is true

    //what about the following settings??? 
    AutomaticMigrationDataLossAllowed = true; //Attention when using this!!!
    MigrationsDirectory = @"Migrations";
    ContextKey = "Demo.Domain.DemoDbContext";
}

我可以在哪里设置这些设置?

最佳答案

安装EntityFrameworkCore.Tools包,以便在包管理器控制台中使用Add-Migration和Update-Database等命令。您不需要调用 Enable-Migrations,顺便说一句,AutomaticMigrationsEnabled 已过时。

关于c# - Enable-Migrations 已过时。使用 Add-Migration 开始使用迁移,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64127543/

相关文章:

c# - 复杂 - 在 Powershell c# 中用 Regex 替换

c# - 缺少显式实现接口(interface)的摘要标签?

c# - 在泛型函数中将类作为参数传递

c# - 如何构建具有多个 GroupBys 的 LINQ?

c# - 如何用 MVC ActionFilter(或其他东西)替换基本 Controller ?

c# - Entity Framework 是存储库吗

entity-framework - 未强制执行 EF Core 并发

Asp.net MVC 之间的差异 <% : and <%=

asp.net-mvc - MVC4 需要哪些程序集?

c# - 如何还原分离实体的更改