【发布时间】:2015-03-26 16:03:46
【问题描述】:
我首先将 EF5 DB 转换为 EF6 代码。在旧设置中,有一些 FK 是字节。并在应用程序中映射到具有下划线类型的字节的枚举。效果很好。
首先转到代码和 EF6,我发现枚举应该“正常工作”的说法,实际上对于常规列似乎就是这种情况。我可以从这里开始
public byte FavPersonality {get;set;}
到这里:
public Personality FavPersonality {get;set;}
但是当涉及到也是外键的列时,我得到了这个错误:
System.ArgumentException : The ResultType of the specified expression is not
compatible with the required type. The expression ResultType is 'Edm.Byte'
but the required type is 'Model.Personality'.
这是 EF6 + Code first 无法完成的事情吗?
编辑:
枚举定义为 :byte
【问题讨论】:
-
您的枚举是否在名称后使用“: byte”定义?
标签: c# enums foreign-keys entity-framework-6