Reputation: 36654
I'm using EF in my applicaiton
I get the following error:
Error 1 Error 3002: Problem in mapping fragments starting at line 1131:Potential runtime violation of table CTIDS's keys (CTIDS.CTID, CTIDS.Carrier): Columns (CTIDS.CTID, CTIDS.Carrier) are mapped to EntitySet CTIDS's properties (CTIDS.CTID1, CTIDS.Carrier) on the conceptual side but they do not form the EntitySet's key properties (CTIDS.AppVersion, CTIDS.CTID1, CTIDS.Carrier). D:\MaM\Server\ClientServices\Dev\ClientService 1.6\Conduit.Mam.ClientService.DAL.EntityFramework\MamModel.edmx 1132 15 Conduit.Mam.ClientService.Common.EntityFramework
double clicking the error leads to this part in the edmx
:
<EntitySetMapping Name="CTIDS">
<EntityTypeMapping TypeName="MaMDBModel.CTID">
<MappingFragment StoreEntitySet="CTIDS">
<ScalarProperty Name="Carrier" ColumnName="Carrier" />
<ScalarProperty Name="AppVersion" ColumnName="AppVersion" />
<ScalarProperty Name="CTID1" ColumnName="CTID" />
</MappingFragment>
</EntityTypeMapping>
I have a table with a composite_PK
which is exactly what reflected in my edmx
:
<EntityType Name="CTIDS"> <Key> <PropertyRef Name="CTID" /> <PropertyRef Name="Carrier" /> </Key> <Property Name="CTID" Type="varchar" Nullable="false" MaxLength="50" /> <Property Name="AppVersion" Type="varchar" Nullable="false" MaxLength="50" /> <Property Name="Carrier" Type="int" Nullable="false" /> </EntityType>
Upvotes: 1
Views: 5450
Reputation: 31610
You only posted the entity describing the store but not the conceptual entity which is mapped to the store entity. From the exception message it appears that the conceptual entity has a composite key that consists of 3 properties (CTIDS.AppVersion, CTIDS.CTID1, CTIDS.Carrier) while the store entity (the one you showed) has a composite entity consisting of 2 properties (CTIDS.CTID, CTIDS.Carrier) which is the reason for the exception.
Upvotes: 1