Alex Rivera | Logout

How to fix System.Data.Edm.EdmEntityType has no key

Asked 2011-03-11T20:08:55.620
15

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.

Edit
Report

1 Answer

3

In the spirit of sharing solutions to the same problem...

I had the same problem but it wasn't fixed by the [Key] solution when coding a MVC 4 app with VS2012.

I forgot to include the getter and setters on my model members. Just having them public isn't enough and Visual Studio will give you the same error message.

I have identified 5 scenarios that result in this message - covered in a small blog post about it.

answered 2013-05-05T17:07:34.187

Your Answer