如何将Entity Framework核心模型与MySQL数据库同步?

问题描述 投票:1回答:1

我创建了实体框架核心模型。这是我的dbcontext。

public DbSet<User> Users { get; set; }
public DbSet<FAQ> FAQs { get; set; }

public PolitcubesDBContext()
{
    Database.EnsureCreated();
}

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
    optionsBuilder.UseMySql(GlobalVariables.MySQLData);
}

但是,如果我改变我的模型代码或添加新的删除旧的模型,然后数据库不同步与我的EF核心应用程序,我怎么能解决这个问题?

c# asp.net entity-framework asp.net-web-api ef-core-3.1
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.