Skip to content

Two entities with possibly different keys are mapped to the same row

I have Table Field1 PK int not null Field2 PK int not null like this when i want to map this table I get this error

Error   3   Error 3034: Problem in mapping fragments starting at lines 2212, 2218:
Two entities with possibly different keys are mapped to the same row.
Ensure these two mapping fragments map both ends of the AssociationSet to the corresponding columns.

And I tried to delete and re-create that table inside model. When i add table it gives another error but at the end i always get this error

How can i handle this problem please help me…



When i investigate the problem, i realised something becuse i read an article before for this data model situation and i understand the why the problem occur. (Problem in mapping fragments in Entity Framework)

Actually problem comes from table mapping because i said that table has many to many relationship so That article says if you put that table in the model design it always gives us this error and finally when we delete that table on design side and add table silently in data model so program can be build. I ‘m telling you this because maybe you can make an idea for this because i learned this and when i add new view in model and vs doesnt give me any error.

This is the old model picture when the delete that table inside red box The program doesn’t give any error and continiue to use bottom table

enter image description here

enter image description here

User contributions licensed under: CC BY-SA
5 People found this is helpful