Thursday, March 5, 2009

Entity Framework: Error 3007

I got an error message after updating my Entity Framework .edmx model:

Error 3007: Problem in Mapping Fragments starting at lines … : Non-Primary-Key column(s) [ColumnName] are being mapped in both fragments to different conceptual side properties - data inconsistency is possible because the corresponding conceptual side properties can be independently modified.

Finally I managed to solve the problem. I added a foreign key to a table, so Entity Framework generated an association. The association name was the same as the foreign key field name. Designer never removes CSDL objects, so these names were the same. I had to remove the entity field to make the model valid. Now it works fine.

4 comments:

  1. could you please provide steps on this? I'm not sure how you implemented this..sorry..thanks!

    ReplyDelete
  2. It was a long time ago. As far as I can remember just delete the field in the designer (if visible) or find that field in the XML and delete that manually.
    It is similar to UML: the reference will represent the relation instead of the field. Unfortunately you have to delete the previously created and useful field manually.

    ReplyDelete