TPT avec le designer et erreurs 3034 et 3021
J'ai identifié deux cas, que j'ai remonté à Corp, d'erreurs apparaissant quand on essaye de faire du TPT avec le designer d'EDM.
Pour rappel, le TPT c'est quand on a deux tables avec la même PK et qu'on veut avoir de l'héritage entre nos deux entity types associés.
Premier cas : erreur 3034
En utilisant cet EDM :
Une table Contacts, une table Employees, une table Offices avec une relation entre Employees et Offices (un employé travaille dans un bureau) et une relation entre Offices et Employees (un bureau a un manager).
<edmx:Runtime>
<!-- SSDL content -->
<edmx:StorageModels>
<Schema Namespace="DotNet35DemoModel.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2008" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2006/04/edm/ssdl">
<EntityContainer Name="DotNet35DemoModelStoreContainer">
<EntitySet Name="Contacts" EntityType="DotNet35DemoModel.Store.Contacts" store:Type="Tables" Schema="dbo" />
<EntitySet Name="Employees" EntityType="DotNet35DemoModel.Store.Employees" store:Type="Tables" Schema="dbo" />
<EntitySet Name="Offices" EntityType="DotNet35DemoModel.Store.Offices" store:Type="Tables" Schema="dbo" />
<AssociationSet Name="FK_Employees_Contacts" Association="DotNet35DemoModel.Store.FK_Employees_Contacts">
<End Role="Contacts" EntitySet="Contacts" />
<End Role="Employees" EntitySet="Employees" />
</AssociationSet>
<AssociationSet Name="FK_Employees_Office" Association="DotNet35DemoModel.Store.FK_Employees_Office">
<End Role="Offices" EntitySet="Offices" />
<End Role="Employees" EntitySet="Employees" />
</AssociationSet>
<AssociationSet Name="FK_Office_Manager" Association="DotNet35DemoModel.Store.FK_Office_Manager">
<End Role="Employees" EntitySet="Employees" />
<End Role="Offices" EntitySet="Offices" />
</AssociationSet>
</EntityContainer>
<EntityType Name="Contacts">
<Key>
<PropertyRef Name="ContactID" />
</Key>
<Property Name="ContactID" Type="uniqueidentifier" Nullable="false" />
</EntityType>
<EntityType Name="Employees">
<Key>
<PropertyRef Name="EmployeeID" />
</Key>
<Property Name="EmployeeID" Type="uniqueidentifier" Nullable="false" />
<Property Name="OfficeID" Type="uniqueidentifier" />
<Property Name="Team" Type="uniqueidentifier" />
</EntityType>
<EntityType Name="Offices">
<Key>
<PropertyRef Name="OfficeID" />
</Key>
<Property Name="OfficeID" Type="uniqueidentifier" Nullable="false" />
<Property Name="ManagerID" Type="uniqueidentifier" />
</EntityType>
<Association Name="FK_Employees_Contacts">
<End Role="Contacts" Type="DotNet35DemoModel.Store.Contacts" Multiplicity="1" />
<End Role="Employees" Type="DotNet35DemoModel.Store.Employees" Multiplicity="0..1" />
<ReferentialConstraint>
<Principal Role="Contacts">
<PropertyRef Name="ContactID" />
</Principal>
<Dependent Role="Employees">
<PropertyRef Name="EmployeeID" />
</Dependent>
</ReferentialConstraint>
</Association>
<Association Name="FK_Employees_Office">
<End Role="Offices" Type="DotNet35DemoModel.Store.Offices" Multiplicity="0..1" />
<End Role="Employees" Type="DotNet35DemoModel.Store.Employees" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="Offices">
<PropertyRef Name="OfficeID" />
</Principal>
<Dependent Role="Employees">
<PropertyRef Name="OfficeID" />
</Dependent>
</ReferentialConstraint>
</Association>
<Association Name="FK_Office_Manager">
<End Role="Employees" Type="DotNet35DemoModel.Store.Employees" Multiplicity="0..1" />
<End Role="Offices" Type="DotNet35DemoModel.Store.Offices" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="Employees">
<PropertyRef Name="EmployeeID" />
</Principal>
<Dependent Role="Offices">
<PropertyRef Name="ManagerID" />
</Dependent>
</ReferentialConstraint>
</Association>
</Schema>
</edmx:StorageModels>
<!-- CSDL content -->
<edmx:ConceptualModels>
<Schema Namespace="DotNet35DemoModel" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2006/04/edm">
<EntityContainer Name="DotNet35DemoEntities5">
<EntitySet Name="Contacts" EntityType="DotNet35DemoModel.Contacts" />
<EntitySet Name="Employees" EntityType="DotNet35DemoModel.Employees" />
<EntitySet Name="Offices" EntityType="DotNet35DemoModel.Offices" />
<AssociationSet Name="FK_Employees_Contacts" Association="DotNet35DemoModel.FK_Employees_Contacts">
<End Role="Contacts" EntitySet="Contacts" />
<End Role="Employees" EntitySet="Employees" />
</AssociationSet>
<AssociationSet Name="FK_Employees_Office" Association="DotNet35DemoModel.FK_Employees_Office">
<End Role="Offices" EntitySet="Offices" />
<End Role="Employees" EntitySet="Employees" />
</AssociationSet>
<AssociationSet Name="FK_Office_Manager" Association="DotNet35DemoModel.FK_Office_Manager">
<End Role="Employees" EntitySet="Employees" />
<End Role="Offices" EntitySet="Offices" />
</AssociationSet>
</EntityContainer>
<EntityType Name="Contacts">
<Key>
<PropertyRef Name="ContactID" />
</Key>
<Property Name="ContactID" Type="Guid" Nullable="false" />
<NavigationProperty Name="Employees" Relationship="DotNet35DemoModel.FK_Employees_Contacts" FromRole="Contacts" ToRole="Employees" />
</EntityType>
<EntityType Name="Employees">
<Key>
<PropertyRef Name="EmployeeID" />
</Key>
<Property Name="EmployeeID" Type="Guid" Nullable="false" />
<NavigationProperty Name="Contacts" Relationship="DotNet35DemoModel.FK_Employees_Contacts" FromRole="Employees" ToRole="Contacts" />
<NavigationProperty Name="Offices" Relationship="DotNet35DemoModel.FK_Employees_Office" FromRole="Employees" ToRole="Offices" />
<NavigationProperty Name="Offices1" Relationship="DotNet35DemoModel.FK_Office_Manager" FromRole="Employees" ToRole="Offices" />
</EntityType>
<EntityType Name="Offices">
<Key>
<PropertyRef Name="OfficeID" />
</Key>
<Property Name="OfficeID" Type="Guid" Nullable="false" />
<NavigationProperty Name="Employees" Relationship="DotNet35DemoModel.FK_Employees_Office" FromRole="Offices" ToRole="Employees" />
<NavigationProperty Name="Employees1" Relationship="DotNet35DemoModel.FK_Office_Manager" FromRole="Offices" ToRole="Employees" />
</EntityType>
<Association Name="FK_Employees_Contacts">
<End Role="Contacts" Type="DotNet35DemoModel.Contacts" Multiplicity="1" />
<End Role="Employees" Type="DotNet35DemoModel.Employees" Multiplicity="0..1" />
<ReferentialConstraint>
<Principal Role="Contacts">
<PropertyRef Name="ContactID" />
</Principal>
<Dependent Role="Employees">
<PropertyRef Name="EmployeeID" />
</Dependent>
</ReferentialConstraint>
</Association>
<Association Name="FK_Employees_Office">
<End Role="Offices" Type="DotNet35DemoModel.Offices" Multiplicity="0..1" />
<End Role="Employees" Type="DotNet35DemoModel.Employees" Multiplicity="*" />
</Association>
<Association Name="FK_Office_Manager">
<End Role="Employees" Type="DotNet35DemoModel.Employees" Multiplicity="0..1" />
<End Role="Offices" Type="DotNet35DemoModel.Offices" Multiplicity="*" />
</Association>
</Schema>
</edmx:ConceptualModels>
<!-- C-S mapping content -->
<edmx:Mappings>
<Mapping Space="C-S" xmlns="urn:schemas-microsoft-com:windows:storage:mapping:CS">
<EntityContainerMapping StorageEntityContainer="DotNet35DemoModelStoreContainer" CdmEntityContainer="DotNet35DemoEntities5">
<EntitySetMapping Name="Contacts">
<EntityTypeMapping TypeName="IsTypeOf(DotNet35DemoModel.Contacts)">
<MappingFragment StoreEntitySet="Contacts">
<ScalarProperty Name="ContactID" ColumnName="ContactID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="Employees">
<EntityTypeMapping TypeName="IsTypeOf(DotNet35DemoModel.Employees)">
<MappingFragment StoreEntitySet="Employees">
<ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="Offices">
<EntityTypeMapping TypeName="IsTypeOf(DotNet35DemoModel.Offices)">
<MappingFragment StoreEntitySet="Offices">
<ScalarProperty Name="OfficeID" ColumnName="OfficeID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<AssociationSetMapping Name="FK_Employees_Contacts" TypeName="DotNet35DemoModel.FK_Employees_Contacts" StoreEntitySet="Employees">
<EndProperty Name="Contacts">
<ScalarProperty Name="ContactID" ColumnName="EmployeeID" />
</EndProperty>
<EndProperty Name="Employees">
<ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
</EndProperty>
</AssociationSetMapping>
<AssociationSetMapping Name="FK_Employees_Office" TypeName="DotNet35DemoModel.FK_Employees_Office" StoreEntitySet="Employees">
<EndProperty Name="Offices">
<ScalarProperty Name="OfficeID" ColumnName="OfficeID" />
</EndProperty>
<EndProperty Name="Employees">
<ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
</EndProperty>
<Condition ColumnName="OfficeID" IsNull="false" />
</AssociationSetMapping>
<AssociationSetMapping Name="FK_Office_Manager" TypeName="DotNet35DemoModel.FK_Office_Manager" StoreEntitySet="Offices">
<EndProperty Name="Employees">
<ScalarProperty Name="EmployeeID" ColumnName="ManagerID" />
</EndProperty>
<EndProperty Name="Offices">
<ScalarProperty Name="OfficeID" ColumnName="OfficeID" />
</EndProperty>
<Condition ColumnName="ManagerID" IsNull="false" />
</AssociationSetMapping>
</EntityContainerMapping>
</Mapping>
</edmx:Mappings>
</edmx:Runtime>
Je veux rajouter de l'héritage entre Employees et Contacts en utilisant le designer.
Pour cela,
- je supprime la relation entre Employees et Contacts
- je supprime la propriété Employees.EmployeeID
- j'ajoute une relation d'héritage entre Employees et Contacts
- je remappe l'entity type Employees
- je remappe les deux relations entre Employees et Offices
A ce moment là, je me retrouve avec deux erreurs :
- Error 3034: Problem in Mapping Fragments starting at lines 260, 272: Two entities with different keys are mapped to the same row. Ensure these two mapping fragments do not map two groups of entities with overlapping keys to the same group of rows.
- Error 3034: Problem in Mapping Fragments starting at lines 267, 280: Two entities with different keys are mapped to the same row. Ensure these two mapping fragments do not map two groups of entities with overlapping keys to the same group of rows.
En regardant mon mapping (en ouvrant l'edmx avec l'éditeur xml) on a ceci :
<Mapping Space="C-S" xmlns="urn:schemas-microsoft-com:windows:storage:mapping:CS">
<EntityContainerMapping StorageEntityContainer="DotNet35DemoModelStoreContainer" CdmEntityContainer="DotNet35DemoEntities5">
<EntitySetMapping Name="Contacts">
<EntityTypeMapping TypeName="IsTypeOf(DotNet35DemoModel.Contacts)">
<MappingFragment StoreEntitySet="Contacts">
<ScalarProperty Name="ContactID" ColumnName="ContactID" />
</MappingFragment>
</EntityTypeMapping>
<EntityTypeMapping TypeName="IsTypeOf(DotNet35DemoModel.Employees)">
<MappingFragment StoreEntitySet="Employees">
<ScalarProperty Name="ContactID" ColumnName="EmployeeID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="Offices">
<EntityTypeMapping TypeName="IsTypeOf(DotNet35DemoModel.Offices)">
<MappingFragment StoreEntitySet="Offices">
<ScalarProperty Name="OfficeID" ColumnName="OfficeID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<AssociationSetMapping Name="FK_Employees_Office" TypeName="DotNet35DemoModel.FK_Employees_Office" StoreEntitySet="Employees">
<EndProperty Name="Employees">
<ScalarProperty Name="ContactID" ColumnName="EmployeeID" />
</EndProperty>
<EndProperty Name="Offices">
<ScalarProperty Name="OfficeID" ColumnName="OfficeID" />
</EndProperty>
</AssociationSetMapping>
<AssociationSetMapping Name="FK_Office_Manager" TypeName="DotNet35DemoModel.FK_Office_Manager" StoreEntitySet="Offices">
<EndProperty Name="Employees">
<ScalarProperty Name="ContactID" ColumnName="ManagerID" />
</EndProperty>
<EndProperty Name="Offices">
<ScalarProperty Name="OfficeID" ColumnName="OfficeID" />
</EndProperty>
</AssociationSetMapping>
</EntityContainerMapping>
</Mapping>
sur les relations, il manque la condition IsNull="false" !
On devrait avoir ceci :
<AssociationSetMapping Name="FK_Employees_Office" TypeName="DotNet35DemoModel.FK_Employees_Office" StoreEntitySet="Employees">
<EndProperty Name="Employees">
<ScalarProperty Name="ContactID" ColumnName="EmployeeID" />
</EndProperty>
<EndProperty Name="Offices">
<ScalarProperty Name="OfficeID" ColumnName="OfficeID" />
</EndProperty>
<Condition ColumnName="OfficeID" IsNull="false"/>
</AssociationSetMapping>
<AssociationSetMapping Name="FK_Office_Manager" TypeName="DotNet35DemoModel.FK_Office_Manager" StoreEntitySet="Offices">
<EndProperty Name="Employees">
<ScalarProperty Name="ContactID" ColumnName="ManagerID" />
</EndProperty>
<EndProperty Name="Offices">
<ScalarProperty Name="OfficeID" ColumnName="OfficeID" />
</EndProperty>
<Condition ColumnName="ManagerID" IsNull="false"/>
</AssociationSetMapping>
Deuxième cas : erreur 3021
Dans ce cas, j'ai une table Contacts, une table Employees et une table Holidays et, comme précédemment, je veux faire du TPT entre Employees et Contacts.
Mon edmx de départ est le suivant :
<edmx:Runtime>
<!-- SSDL content -->
<edmx:StorageModels>
<Schema Namespace="DotNet35DemoModel1.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2008" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2006/04/edm/ssdl">
<EntityContainer Name="DotNet35DemoModel1StoreContainer">
<EntitySet Name="Contacts" EntityType="DotNet35DemoModel1.Store.Contacts" store:Type="Tables" Schema="dbo" />
<EntitySet Name="Employees" EntityType="DotNet35DemoModel1.Store.Employees" store:Type="Tables" Schema="dbo" />
<EntitySet Name="Holidays" EntityType="DotNet35DemoModel1.Store.Holidays" store:Type="Tables" Schema="dbo" />
<AssociationSet Name="FK_Employees_Contacts" Association="DotNet35DemoModel1.Store.FK_Employees_Contacts">
<End Role="Contacts" EntitySet="Contacts" />
<End Role="Employees" EntitySet="Employees" />
</AssociationSet>
<AssociationSet Name="FK_Holidays_Employees" Association="DotNet35DemoModel1.Store.FK_Holidays_Employees">
<End Role="Employees" EntitySet="Employees" />
<End Role="Holidays" EntitySet="Holidays" />
</AssociationSet>
</EntityContainer>
<EntityType Name="Contacts">
<Key>
<PropertyRef Name="ContactID" />
</Key>
<Property Name="ContactID" Type="uniqueidentifier" Nullable="false" />
</EntityType>
<EntityType Name="Employees">
<Key>
<PropertyRef Name="EmployeeID" />
</Key>
<Property Name="EmployeeID" Type="uniqueidentifier" Nullable="false" />
</EntityType>
<EntityType Name="Holidays">
<Key>
<PropertyRef Name="EmployeeId" />
<PropertyRef Name="From" />
</Key>
<Property Name="EmployeeId" Type="uniqueidentifier" Nullable="false" />
<Property Name="From" Type="datetime" Nullable="false" />
</EntityType>
<Association Name="FK_Employees_Contacts">
<End Role="Contacts" Type="DotNet35DemoModel1.Store.Contacts" Multiplicity="1" />
<End Role="Employees" Type="DotNet35DemoModel1.Store.Employees" Multiplicity="0..1" />
<ReferentialConstraint>
<Principal Role="Contacts">
<PropertyRef Name="ContactID" />
</Principal>
<Dependent Role="Employees">
<PropertyRef Name="EmployeeID" />
</Dependent>
</ReferentialConstraint>
</Association>
<Association Name="FK_Holidays_Employees">
<End Role="Employees" Type="DotNet35DemoModel1.Store.Employees" Multiplicity="1" />
<End Role="Holidays" Type="DotNet35DemoModel1.Store.Holidays" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="Employees">
<PropertyRef Name="EmployeeID" />
</Principal>
<Dependent Role="Holidays">
<PropertyRef Name="EmployeeId" />
</Dependent>
</ReferentialConstraint>
</Association>
</Schema>
</edmx:StorageModels>
<!-- CSDL content -->
<edmx:ConceptualModels>
<Schema Namespace="DotNet35DemoModel1" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2006/04/edm">
<EntityContainer Name="DotNet35DemoEntities1">
<EntitySet Name="Contacts" EntityType="DotNet35DemoModel1.Contacts" />
<EntitySet Name="Employees" EntityType="DotNet35DemoModel1.Employees" />
<EntitySet Name="Holidays" EntityType="DotNet35DemoModel1.Holidays" />
<AssociationSet Name="FK_Employees_Contacts" Association="DotNet35DemoModel1.FK_Employees_Contacts">
<End Role="Contacts" EntitySet="Contacts" />
<End Role="Employees" EntitySet="Employees" />
</AssociationSet>
<AssociationSet Name="FK_Holidays_Employees" Association="DotNet35DemoModel1.FK_Holidays_Employees">
<End Role="Employees" EntitySet="Employees" />
<End Role="Holidays" EntitySet="Holidays" />
</AssociationSet>
</EntityContainer>
<EntityType Name="Contacts">
<Key>
<PropertyRef Name="ContactID" />
</Key>
<Property Name="ContactID" Type="Guid" Nullable="false" />
<NavigationProperty Name="Employees" Relationship="DotNet35DemoModel1.FK_Employees_Contacts" FromRole="Contacts" ToRole="Employees" />
</EntityType>
<EntityType Name="Employees">
<Key>
<PropertyRef Name="EmployeeID" />
</Key>
<Property Name="EmployeeID" Type="Guid" Nullable="false" />
<NavigationProperty Name="Contacts" Relationship="DotNet35DemoModel1.FK_Employees_Contacts" FromRole="Employees" ToRole="Contacts" />
<NavigationProperty Name="Holidays" Relationship="DotNet35DemoModel1.FK_Holidays_Employees" FromRole="Employees" ToRole="Holidays" />
</EntityType>
<EntityType Name="Holidays">
<Key>
<PropertyRef Name="EmployeeId" />
<PropertyRef Name="From" />
</Key>
<Property Name="EmployeeId" Type="Guid" Nullable="false" />
<Property Name="From" Type="DateTime" Nullable="false" />
<NavigationProperty Name="Employees" Relationship="DotNet35DemoModel1.FK_Holidays_Employees" FromRole="Holidays" ToRole="Employees" />
</EntityType>
<Association Name="FK_Employees_Contacts">
<End Role="Contacts" Type="DotNet35DemoModel1.Contacts" Multiplicity="1" />
<End Role="Employees" Type="DotNet35DemoModel1.Employees" Multiplicity="0..1" />
<ReferentialConstraint>
<Principal Role="Contacts">
<PropertyRef Name="ContactID" />
</Principal>
<Dependent Role="Employees">
<PropertyRef Name="EmployeeID" />
</Dependent>
</ReferentialConstraint>
</Association>
<Association Name="FK_Holidays_Employees">
<End Role="Employees" Type="DotNet35DemoModel1.Employees" Multiplicity="1" />
<End Role="Holidays" Type="DotNet35DemoModel1.Holidays" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="Employees">
<PropertyRef Name="EmployeeID" />
</Principal>
<Dependent Role="Holidays">
<PropertyRef Name="EmployeeId" />
</Dependent>
</ReferentialConstraint>
</Association>
</Schema>
</edmx:ConceptualModels>
<!-- C-S mapping content -->
<edmx:Mappings>
<Mapping Space="C-S" xmlns="urn:schemas-microsoft-com:windows:storage:mapping:CS">
<EntityContainerMapping StorageEntityContainer="DotNet35DemoModel1StoreContainer" CdmEntityContainer="DotNet35DemoEntities1">
<EntitySetMapping Name="Contacts">
<EntityTypeMapping TypeName="IsTypeOf(DotNet35DemoModel1.Contacts)">
<MappingFragment StoreEntitySet="Contacts">
<ScalarProperty Name="ContactID" ColumnName="ContactID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="Employees">
<EntityTypeMapping TypeName="IsTypeOf(DotNet35DemoModel1.Employees)">
<MappingFragment StoreEntitySet="Employees">
<ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="Holidays">
<EntityTypeMapping TypeName="IsTypeOf(DotNet35DemoModel1.Holidays)">
<MappingFragment StoreEntitySet="Holidays">
<ScalarProperty Name="EmployeeId" ColumnName="EmployeeId" />
<ScalarProperty Name="From" ColumnName="From" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<AssociationSetMapping Name="FK_Employees_Contacts" TypeName="DotNet35DemoModel1.FK_Employees_Contacts" StoreEntitySet="Employees">
<EndProperty Name="Contacts">
<ScalarProperty Name="ContactID" ColumnName="EmployeeID" />
</EndProperty>
<EndProperty Name="Employees">
<ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
</EndProperty>
</AssociationSetMapping>
<AssociationSetMapping Name="FK_Holidays_Employees" TypeName="DotNet35DemoModel1.FK_Holidays_Employees" StoreEntitySet="Holidays">
<EndProperty Name="Employees">
<ScalarProperty Name="EmployeeID" ColumnName="EmployeeId" />
</EndProperty>
<EndProperty Name="Holidays">
<ScalarProperty Name="EmployeeId" ColumnName="EmployeeId" />
<ScalarProperty Name="From" ColumnName="From" />
</EndProperty>
</AssociationSetMapping>
</EntityContainerMapping>
</Mapping>
</edmx:Mappings>
</edmx:Runtime>
Après avoir reproduit le scénario précédent, j'ai l'erreur suivante :
Error 3021: Problem in Mapping Fragment starting at line 124: Each of the following columns in table Holidays is mapped to multiple conceptual side properties:
Holidays.EmployeeId is mapped to <FK_Holidays_Employees.Employees.ContactID, FK_Holidays_Employees.Holidays.EmployeeId>
Le problème vient du fait que la ReferentialConstraint (obligatoire dans le cas de relation sur une colonne de la clé) a "disparue" :
<Association Name="FK_Holidays_Employees">
<End Role="Employees" Type="DotNet35DemoModel1.Employees" Multiplicity="1" />
<End Role="Holidays" Type="DotNet35DemoModel1.Holidays" Multiplicity="*" />
</Association>
Il faut la rajouter :
<Association Name="FK_Holidays_Employees">
<End Role="Employees" Type="DotNet35DemoModel1.Employees" Multiplicity="1" />
<End Role="Holidays" Type="DotNet35DemoModel1.Holidays" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="Employees">
<PropertyRef Name="ContactID" />
</Principal>
<Dependent Role="Holidays">
<PropertyRef Name="EmployeeId" />
</Dependent>
</ReferentialConstraint>
</Association>
Quelques petits bugs du designer donc mais rappelons que le designer n'est qu'une aide et que cela ne vous empêche en aucun cas d'utiliser l'Entity Framework.
Ce post vous a plu ? Ajoutez le dans vos favoris pour ne pas perdre de temps à le retrouver le jour où vous en aurez besoin :