简体   繁体   中英

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: 在此输入图像描述

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM