Entity framework - "Problem in mapping fragments"-error. Help me understand the explanations of this error

entity-framework

Solution

Since Slices.WheelId is an FK, you cannot expose it in your client model, period. There are ways to get the value, though.

var wheelId = someSlice.Wheels.ID;

Update In EF 4 you can do this by using FK Associations instead of independent associations.

Problem

Error 3007: Problem in Mapping Fragments starting at lines 186, 205: Non-Primary-Key column(s) [WheelID] 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. I found several places on the web describing this error, but I simply don't understand them. (confused smiley goes here) One Two Three Four There is something pretty fundamental here, I must be missing. Can you explain it, so that I understand it? Maybe using my real life example below? Foreign key 1:N Wheels.Id -> Slices.WheelId I add them to entity framework, and WheelId is not visible in the Slices-entity. Doing some workaround (deleting the relationship from the db before adding tables to EF - then re-creating it and updating EF) I managed to get the WheelId to stay in Slices, but then I get the error mentioned at the top.

Original source

Related problems