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.