我从启用迁移开始,然后初始化迁移,visual studio生成201502151515_initial.cs
我在201502151515_initial.cs文件中做了一些更改并转到update-database.
然后我明白我在模型中有一些错误.
然后,如果我尝试更新数据库,它将失败并显示此错误:
Unable to update database to match the current model because there are
pending changes and automatic migration is disabled. Either write the
pending model changes to a code-based migration or enable automatic
migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to
true to enable automatic migration. You can use the Add-Migration
command to write the pending model changes to a code-based migration.
无论如何更新当前的201502151515_initial.cs文件?
我可以手动完成,这是一项任务,以确保一切正常.
我可以删除当前文件并再次创建它,在这种情况下我与数据库不一致(因为我已经更新数据库).
或者找到更好的方法来更新当前文件.
这是更好的方法吗?
@R_502_5620@
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。