Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

At least one property must be mapped Entity Framework 6 Error

ERROR: At least one property must be mapped in the set mapping for 'AspNetUserRoles'

Desc: I am not quite sure how this error is occurring or what it actually means. With that said I am totally lost on how to fix it. Other than the User table this is all done from the defaul ASP User Auth creation for Web API 2 Template.

Screenshot: enter image description here

like image 688
allencoded Avatar asked Mar 07 '14 02:03

allencoded


1 Answers

That happen because maybe was made an "update model from database", and the names of the fields in the table "[AspNetUserRoles]" are different from the first time.

If you look the tables [AspNetRoles] and [AspNetUsers] they have two navigation properties repeated ("AspNetUsers1" and "AspNetUsers") and ("AspNetRoles1" and "AspNetRoles") who are the new properties created.

So in order to fix the problem, it's necessary delete the old navigation properties and the old association.

After that, to keep clean the model you could rename the properties from AspNetUsers1 to AspNetUsers again. The same for the association.

like image 65
user3317084 Avatar answered Nov 15 '22 20:11

user3317084