Mapping and metadata information could not be foun
Mapping and metadata information could not be foun
circle_july 发表于2年前
Mapping and metadata information could not be foun
  • 发表于 2年前
  • 阅读 11
  • 收藏 0
  • 点赞 0
  • 评论 0

华为云·免费上云实践>>>   

摘要: EF 在添加实体的时候抛出来的异常 Mapping and metadata information could not be found for EntityType 'XXXXX',

EF 在添加实体的时候抛出来的异常
Mapping and metadata information could not be found for EntityType 'XXXXX',

在stackoverflow 搜出来的答案是:

http://stackoverflow.com/questions/2350514/ef-mapping-and-metadata-information-could-not-be-found-for-entitytype-error

For anyone else dealing with the error, I think it's worth mentioning some scenarios that I've found that cause this (extremely unhelpful) error:

  • Misspelled properties (case-sensitive!)

  • Properties missing in the POCO class

  • Type mismatches between the POCO and entity-type (e.g., int instead of long)

  • Enums in the POCO (EF doesn't support enums right now as I understand)

There might be other causes as well.


大概意思是你的属性错误

我看了看 又不太可能

然后一个一个去找的时候发现是 枚举不能为默认值(我是用moq 来模拟的 所以没注意到,一般的情况下,不会有这样的情况发生)

共有 人打赏支持
粉丝 0
博文 5
码字总数 1076
×
circle_july
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: