使用EF核心更新数据库时出错 [英] Error when update database usin EF core

查看:238
本文介绍了使用EF核心更新数据库时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我向我的解决方案添加了一个新的迁移,当尝试使用此命令(Update-Database)更新数据库时,会显示一条错误消息数据库中已存在名为'Currency'的对象。 ',我正在使用实体框架核心2.0



我尝试过:



添加迁移NewMigration

更新数据库

I add a new migration to my solution , and when trying to update database using this command (Update-Database) , there is an error message shown 'There is already an object named 'Currency' in the database. ', i'm using entity framework core 2.0

What I have tried:

Add-Migration NewMigration
Update-Database

推荐答案

阅读错误消息。已经有一些表,可能在您的数据库中称为Currency。你不能有两个表或任何其他对象,具有相同的名称。



此外,货币可能是数据库引擎中的保留字'正在使用。你必须打电话给你的桌子或其他任何对象,还有别的东西。
Read the error message. There's already some table, probably, called Currency in your database. You can't have two tables, or any other object for that matter, with the same name.

Also, Currency might be a reserved word in the database engine you're using. You'll have to call your table, or whatever other object it is, something else.


这篇关于使用EF核心更新数据库时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆