C# EntityType没有定义键。定义此EntityType的键
我有一个简单的WCF服务项目,其中添加了实体框架。正如您所看到的,Entity类看起来很好。然而,当我运行该项目时,我会遇到奇怪的异常C# EntityType没有定义键。定义此EntityType的键,c#,entity-framework,wcf,C#,Entity Framework,Wcf,我有一个简单的WCF服务项目,其中添加了实体框架。正如您所看到的,Entity类看起来很好。然而,当我运行该项目时,我会遇到奇怪的异常EntityType'AccountOperationEntity'没有定义键。定义此EntityType的键。我以前在EF中从未遇到过类似的问题。有人能解释一下发生了什么事吗?我创建的所有类都会出现此异常 public class AccountOperationEntity { [Key] public uint Id { get; set;
EntityType'AccountOperationEntity'没有定义键。定义此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; }
}
当我尝试
启用迁移时也会发生这种情况
只是不支持Uint作为实体框架中的键
Uint只是不支持作为实体框架中的键
@KasunjithBimal没有[Table]它不应该工作吗?@KasunjithBimal没有[Table]它不应该工作吗?谢谢,这对我来说真的很神秘。错误应该是“uint not supported”。谢谢,这对我来说真的很神秘。错误应该是“uint not supported”。