Tinyint(byte),SmallInt(Int16) not compatible with Enum in EF5

喜你入骨 提交于 2019-12-03 01:18:15

Well if anyone is interested the problem is in enum's default type:

public enum MyEnumType 
{ One, Two, Three, All }

Since enum defaults to type int, [Underlying Type:{Byte}] doesn't match type of [External Type] {MyEnumType:Int} so to fix it for my original tinyint field you need to define your enum like this:

public enum MyEnumType : byte
{ One, Two, Three, All }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!