Mapping and metadata information could not be found for EntityType 'XXXXX',
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 来模拟的 所以没注意到,一般的情况下,不会有这样的情况发生)