Reputation: 7208
I have a simple WCF service project to which I've added Entity Framework. As you can see the Entity class looks well. However when I'm running the project, I'm getting weird exception EntityType 'AccountOperationEntity' has no key defined. Define the key for this EntityType.
I've never had problems like this before with EF. Could someone explain me what 's going on? I get this exception with all classes I create.
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; }
}
This also happens when I try to enable-migrations
.
Upvotes: 0
Views: 89
Reputation: 328
Uint is just not supported as key in Entity Framework.
https://entityframework.codeplex.com/workitem/1489
Upvotes: 3