您的位置:首页 > 移动开发

Mapping and metadata information could not be foun

2015-12-30 00:00 477 查看
摘要: 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 来模拟的 所以没注意到,一般的情况下,不会有这样的情况发生)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: