我有一个简单的WCF服务项目,我已经添加了实体框架。如您所见,实体类看起来很好。然而,当我运行这个项目时,我得到了奇怪的异常,EntityType 'AccountOperationEntity' has no key defined. Define the key for this EntityType.
,我以前从未遇到过这样的EF问题。有人能解释一下发生了什么事吗?我创建的所有类都有这个例外。
public class AccountOperationEntity
{
[Key]
public uint Id { get; set; }
public virtual AccountEntity Account { get; set; }
public OperationType OperationType { get; set; }
public float Amount { get; set; }
public DateTime DateTime { get; set; }
}
当我尝试enable-migrations
时,也会发生这种情况。
发布于 2017-10-20 17:31:37
在实体框架中,Uint只是不受支持。
https://stackoverflow.com/questions/46854246
复制相似问题