ASP.NET Core Code First 数据库迁移

4

我们如何在asp.net core中使用数据迁移?我已经尝试查看asp.net core文档,但没有找到相关内容。

以下是asp.net 4的代码:

internal sealed class Configuration : DbMigrationsConfiguration<ApplicationDbContext>
{
    public Configuration()
    {
        AutomaticMigrationsEnabled = true;
    }

    protected override void Seed(ApplicationDbContext context)
    {
        base.Seed(context);

        //Add stuff to database

        context.SaveChanges();
    }
}

在asp.net core中的等效方法是什么?


请阅读以下内容:https://docs.asp.net/en/latest/data/entity-framework-6.html 和 https://docs.efproject.net/en/latest/platforms/aspnetcore/,这可能会有所帮助。 - M.Hassan
这是我在寻找Entity Framework 7方面的答案:https://dev59.com/qlsW5IYBdhLWcg3w2aGK - Martin Dawson
1个回答

2

你是说在EF Core中根本不能使用Database.SetInitializer()等方法吗? - MEMark

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接