EntityType 'MyProfile' has no key defined. Define the key for this EntityType

后端 未结 2 1370
甜味超标
甜味超标 2021-02-18 23:32

I am not sure why I am getting this error message. I have a primary key defined in my sql database for it. Here is my code:

[HttpPost]
    public ActionResult          


        
2条回答
  •  离开以前
    2021-02-18 23:50

    I ran into this issue also and wanted to add that in Entity Framework version 6 this error occurs because the DbgGeography type has been moved from the assembly system.data.entity and into the entityframework.dll

    to resolve this in EF 6+ remove the reference to the entity dll and change the using statement to using System.Data.Entity.Spatial

    see this http://entityframework.codeplex.com/workitem/1535

提交回复
热议问题