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

后端 未结 2 1375
甜味超标
甜味超标 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:54

    Which field is your key? Whichever it is - ProfileId or UserId - either change the name to MyProfileId or Id or else put a [Key] attribute on it.

提交回复
热议问题