At least one property must be mapped Entity Framework 6 Error

asp.net-mvc c# entity-framework-6

Question

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

1
5
3/7/2014 2:54:14 AM

Popular Answer

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.

6
10/16/2015 7:34:28 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow