How to Repair the System There is no key for Data.Edm.EdmEntityType.

.net asp.net-mvc entity-framework linq

Question

Does anybody know how to fix this error:

System.Data.Edm.EdmEntityType: : EntityType 'BlogTags' has no key defined. Define the key for this EntityType.

Using MVC 3 with Entity Framework.

1
14
8/1/2013 3:30:52 PM

Accepted Answer

The error tells you all you need to know: "Define the key for this EntityType".

In EF all entities must have primary keys of some type.

5
3/11/2011 8:14:36 PM

Popular Answer

Just put [Key] on top of your property (which is presenting primary key). Something like this,

[Key]
public int BlogTypeId { get; set; }


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow