当我运行代码要求我进行代码迁移以更新数据库时,会发生运行时错误。我不确定该怎么做,有人可以帮助我吗?
自创建数据库以来,支持“ ApplicationDbContext”上下文的模型已更改。考虑使用代码优先迁移来更新数据库
您必须在上下文配置文件中启用自动迁移
internal class Configuration : DbMigrationsConfiguration<YourContext>
{
public Configuration()
{
this.AutomaticMigrationsEnabled = true;
this.AutomaticMigrationDataLossAllowed = false;
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句