I'm getting the following error on my database first model in Entity Framework:
Error 3032: Problem in mapping fragments starting at lines 3434, 4312:EntityTypes Model.Docent, Model.Student are being mapped to the same rows in table Attendee. Mapping conditions can be used to distinguish the rows that these types are mapped to.
While I already added conditions to these models:
<EntityTypeMapping TypeName="IsTypeOf(Model.Student)">
<MappingFragment StoreEntitySet="Attendee">
<ScalarProperty Name="Id" ColumnName="atnId" />
<Condition ColumnName="atnTypeId" Value="1" />
</MappingFragment>
</EntityTypeMapping>
And
<EntityTypeMapping TypeName="IsTypeOf(Model.Docent)">
<MappingFragment StoreEntitySet="Attendee">
<ScalarProperty Name="AvailabilityApprovedByType" ColumnName="atnAvailabilityApprovedByAttId" />
<ScalarProperty Name="Id" ColumnName="atnId" />
<Condition ColumnName="atnTypeId" Value="2" />
</MappingFragment>
</EntityTypeMapping>
Their is a more complex hierarchy, possibly that's the problem. But I'm unsure how to proceed. This a the hierarchy:
Attendee (Abstract)
-> Facility (Type = 3)
-> AttendeeCollection (Abstract)
-> Team (Type = 4)
-> Group (Type = 5)
-> Person (Abstract)
-> Student (Type = 1)
-> Docent (Type = 2)