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

前端 未结 6 2063
误落风尘
误落风尘 2021-01-08 01:17

Does anybody know how to fix this error:

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

6条回答
  •  甜味超标
    2021-01-08 01:32

    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.

提交回复
热议问题