Data Platform Developer Center >
Data Platform Development Forums
>
ADO.NET Entity Framework and LINQ to Entities
>
Association/mapping (Error 3034)
Association/mapping (Error 3034)
- I have following tables:
Person, Role, External Role, Visitor and Company.
Person/Role (1:N)
ExternalRole is Role subtype
Visitor is ExternalRole subtype
Visitor/Organization (N:1)
Person (1) --- (*) Role<-->ExternalRole<-->Visitor (*) --- (1)Organization
Using base type option and mappings I am able to link Visitor, ExternalRole and Role tables without problems.
When I add Organization table to the model it gets connected to the ExternalRole table instead of Visitor table and
it results with error - something related to "association mapping, two rows different keys"
Can someone help mi with this one?
Thank you!- Edited byZTREWQ Wednesday, November 04, 2009 10:44 AM
All Replies
- Can you post your model?
This posting is provided "AS IS" with no warranties, and confers no rights. - Thank you for your response.
Here is what I get when I create model from database. When I try to compile the project it fails with following errors:
Error 1 Error 3034: Problem in Mapping Fragments starting at lines 244, 278: Two entities with possibly different keys are mapped to the same row. Ensure these two mapping fragments map both ends of the AssociationSet to the corresponding columns.
D:\Temp\WindowsFormsApplication1\WindowsFormsApplication1\Model_Test.edmx 245 15 WindowsFormsApplication1
Error 2 Error 3034: Problem in Mapping Fragments starting at lines 258, 278: Two entities with possibly different keys are mapped to the same row. Ensure these two mapping fragments map both ends of the AssociationSet to the corresponding columns.
D:\Temp\WindowsFormsApplication1\WindowsFormsApplication1\Model_Test.edmx 279 11 WindowsFormsApplication1<?xml version="1.0" encoding="utf-8"?> <edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"> <!-- EF Runtime content --> <edmx:Runtime> <!-- SSDL content --> <edmx:StorageModels> <Schema Namespace="TestModel.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="TestModelStoreContainer"> <EntitySet Name="ExternalRole" EntityType="TestModel.Store.ExternalRole" store:Type="Tables" Schema="dbo" /> <EntitySet Name="Organization" EntityType="TestModel.Store.Organization" store:Type="Tables" Schema="dbo" /> <EntitySet Name="Person" EntityType="TestModel.Store.Person" store:Type="Tables" Schema="dbo" /> <EntitySet Name="Role" EntityType="TestModel.Store.Role" store:Type="Tables" Schema="dbo" /> <EntitySet Name="Visitor" EntityType="TestModel.Store.Visitor" store:Type="Tables" Schema="dbo" /> <AssociationSet Name="FK_EXTERNALROLE_ROLE" Association="TestModel.Store.FK_EXTERNALROLE_ROLE"> <End Role="Role" EntitySet="Role" /> <End Role="ExternalRole" EntitySet="ExternalRole" /> </AssociationSet> <AssociationSet Name="FK_ROLE_PERSON" Association="TestModel.Store.FK_ROLE_PERSON"> <End Role="Person" EntitySet="Person" /> <End Role="Role" EntitySet="Role" /> </AssociationSet> <AssociationSet Name="FK_VISITOR_EXTERNALROLE" Association="TestModel.Store.FK_VISITOR_EXTERNALROLE"> <End Role="ExternalRole" EntitySet="ExternalRole" /> <End Role="Visitor" EntitySet="Visitor" /> </AssociationSet> <AssociationSet Name="FK_VISITOR_ORGANIZATION" Association="TestModel.Store.FK_VISITOR_ORGANIZATION"> <End Role="Organization" EntitySet="Organization" /> <End Role="Visitor" EntitySet="Visitor" /> </AssociationSet> </EntityContainer> <EntityType Name="ExternalRole"> <Key> <PropertyRef Name="RoleID" /> </Key> <Property Name="RoleID" Type="int" Nullable="false" /> </EntityType> <EntityType Name="Organization"> <Key> <PropertyRef Name="OrganizationID" /> </Key> <Property Name="OrganizationID" Type="int" Nullable="false" StoreGeneratedPattern="Identity" /> </EntityType> <EntityType Name="Person"> <Key> <PropertyRef Name="PersonID" /> </Key> <Property Name="PersonID" Type="int" Nullable="false" StoreGeneratedPattern="Identity" /> </EntityType> <EntityType Name="Role"> <Key> <PropertyRef Name="RoleID" /> </Key> <Property Name="RoleID" Type="int" Nullable="false" StoreGeneratedPattern="Identity" /> <Property Name="PersonID" Type="int" Nullable="false" /> </EntityType> <EntityType Name="Visitor"> <Key> <PropertyRef Name="RoleID" /> </Key> <Property Name="RoleID" Type="int" Nullable="false" /> <Property Name="OrganizationID" Type="int" Nullable="false" /> </EntityType> <Association Name="FK_EXTERNALROLE_ROLE"> <End Role="Role" Type="TestModel.Store.Role" Multiplicity="1"> <OnDelete Action="Cascade" /> </End> <End Role="ExternalRole" Type="TestModel.Store.ExternalRole" Multiplicity="0..1" /> <ReferentialConstraint> <Principal Role="Role"> <PropertyRef Name="RoleID" /> </Principal> <Dependent Role="ExternalRole"> <PropertyRef Name="RoleID" /> </Dependent> </ReferentialConstraint> </Association> <Association Name="FK_ROLE_PERSON"> <End Role="Person" Type="TestModel.Store.Person" Multiplicity="1"> <OnDelete Action="Cascade" /> </End> <End Role="Role" Type="TestModel.Store.Role" Multiplicity="*" /> <ReferentialConstraint> <Principal Role="Person"> <PropertyRef Name="PersonID" /> </Principal> <Dependent Role="Role"> <PropertyRef Name="PersonID" /> </Dependent> </ReferentialConstraint> </Association> <Association Name="FK_VISITOR_EXTERNALROLE"> <End Role="ExternalRole" Type="TestModel.Store.ExternalRole" Multiplicity="1"> <OnDelete Action="Cascade" /> </End> <End Role="Visitor" Type="TestModel.Store.Visitor" Multiplicity="0..1" /> <ReferentialConstraint> <Principal Role="ExternalRole"> <PropertyRef Name="RoleID" /> </Principal> <Dependent Role="Visitor"> <PropertyRef Name="RoleID" /> </Dependent> </ReferentialConstraint> </Association> <Association Name="FK_VISITOR_ORGANIZATION"> <End Role="Organization" Type="TestModel.Store.Organization" Multiplicity="1"> <OnDelete Action="Cascade" /> </End> <End Role="Visitor" Type="TestModel.Store.Visitor" Multiplicity="*" /> <ReferentialConstraint> <Principal Role="Organization"> <PropertyRef Name="OrganizationID" /> </Principal> <Dependent Role="Visitor"> <PropertyRef Name="OrganizationID" /> </Dependent> </ReferentialConstraint> </Association> </Schema></edmx:StorageModels> <!-- CSDL content --> <edmx:ConceptualModels> <Schema Namespace="TestModel" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2006/04/edm"> <EntityContainer Name="TestEntities"> <EntitySet Name="ExternalRole" EntityType="TestModel.ExternalRole" /> <EntitySet Name="Person" EntityType="TestModel.Person" /> <EntitySet Name="Role" EntityType="TestModel.Role" /> <EntitySet Name="Visitor" EntityType="TestModel.Visitor" /> <AssociationSet Name="FK_EXTERNALROLE_ROLE" Association="TestModel.FK_EXTERNALROLE_ROLE"> <End Role="Role" EntitySet="Role" /> <End Role="ExternalRole" EntitySet="ExternalRole" /> </AssociationSet> <AssociationSet Name="FK_VISITOR_EXTERNALROLE" Association="TestModel.FK_VISITOR_EXTERNALROLE"> <End Role="ExternalRole" EntitySet="ExternalRole" /> <End Role="Visitor" EntitySet="Visitor" /> </AssociationSet> <AssociationSet Name="FK_ROLE_PERSON" Association="TestModel.FK_ROLE_PERSON"> <End Role="Person" EntitySet="Person" /> <End Role="Role" EntitySet="Role" /> </AssociationSet> <EntitySet Name="Organization" EntityType="TestModel.Organization" /> <AssociationSet Name="Visitor1" Association="TestModel.Visitor1"> <End Role="ExternalRole" EntitySet="ExternalRole" /> <End Role="Organization" EntitySet="Organization" /></AssociationSet></EntityContainer> <EntityType Name="ExternalRole"> <Key> <PropertyRef Name="RoleID" /> </Key> <Property Name="RoleID" Type="Int32" Nullable="false" /> <NavigationProperty Name="Role" Relationship="TestModel.FK_EXTERNALROLE_ROLE" FromRole="ExternalRole" ToRole="Role" /> <NavigationProperty Name="Visitor" Relationship="TestModel.FK_VISITOR_EXTERNALROLE" FromRole="ExternalRole" ToRole="Visitor" /> <NavigationProperty Name="Organization" Relationship="TestModel.Visitor1" FromRole="ExternalRole" ToRole="Organization" /></EntityType> <EntityType Name="Person"> <Key> <PropertyRef Name="PersonID" /> </Key> <Property Name="PersonID" Type="Int32" Nullable="false" /> <NavigationProperty Name="Role" Relationship="TestModel.FK_ROLE_PERSON" FromRole="Person" ToRole="Role" /> </EntityType> <EntityType Name="Role"> <Key> <PropertyRef Name="RoleID" /> </Key> <Property Name="RoleID" Type="Int32" Nullable="false" /> <NavigationProperty Name="ExternalRole" Relationship="TestModel.FK_EXTERNALROLE_ROLE" FromRole="Role" ToRole="ExternalRole" /> <NavigationProperty Name="Person" Relationship="TestModel.FK_ROLE_PERSON" FromRole="Role" ToRole="Person" /> </EntityType> <EntityType Name="Visitor"> <Key> <PropertyRef Name="RoleID" /> </Key> <Property Name="RoleID" Type="Int32" Nullable="false" /> <Property Name="OrganizationID" Type="Int32" Nullable="false" /> <NavigationProperty Name="ExternalRole" Relationship="TestModel.FK_VISITOR_EXTERNALROLE" FromRole="Visitor" ToRole="ExternalRole" /> </EntityType> <Association Name="FK_EXTERNALROLE_ROLE"> <End Role="Role" Type="TestModel.Role" Multiplicity="1"> <OnDelete Action="Cascade" /> </End> <End Role="ExternalRole" Type="TestModel.ExternalRole" Multiplicity="0..1" /> <ReferentialConstraint> <Principal Role="Role"> <PropertyRef Name="RoleID" /> </Principal> <Dependent Role="ExternalRole"> <PropertyRef Name="RoleID" /> </Dependent> </ReferentialConstraint> </Association> <Association Name="FK_VISITOR_EXTERNALROLE"> <End Role="ExternalRole" Type="TestModel.ExternalRole" Multiplicity="1"> <OnDelete Action="Cascade" /> </End> <End Role="Visitor" Type="TestModel.Visitor" Multiplicity="0..1" /> <ReferentialConstraint> <Principal Role="ExternalRole"> <PropertyRef Name="RoleID" /> </Principal> <Dependent Role="Visitor"> <PropertyRef Name="RoleID" /> </Dependent> </ReferentialConstraint> </Association> <Association Name="FK_ROLE_PERSON"> <End Role="Person" Type="TestModel.Person" Multiplicity="1"> <OnDelete Action="Cascade" /> </End> <End Role="Role" Type="TestModel.Role" Multiplicity="*" /> </Association> <EntityType Name="Organization"> <Key> <PropertyRef Name="OrganizationID" /></Key> <Property Name="OrganizationID" Type="Int32" Nullable="false" /> <NavigationProperty Name="ExternalRole" Relationship="TestModel.Visitor1" FromRole="Organization" ToRole="ExternalRole" /></EntityType> <Association Name="Visitor1"> <End Type="TestModel.ExternalRole" Role="ExternalRole" Multiplicity="*" /> <End Type="TestModel.Organization" Role="Organization" Multiplicity="0..1" /></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="TestModelStoreContainer" CdmEntityContainer="TestEntities"> <EntitySetMapping Name="ExternalRole"> <EntityTypeMapping TypeName="IsTypeOf(TestModel.ExternalRole)"> <MappingFragment StoreEntitySet="ExternalRole"> <ScalarProperty Name="RoleID" ColumnName="RoleID" /> </MappingFragment> </EntityTypeMapping> </EntitySetMapping> <EntitySetMapping Name="Person"> <EntityTypeMapping TypeName="IsTypeOf(TestModel.Person)"> <MappingFragment StoreEntitySet="Person"> <ScalarProperty Name="PersonID" ColumnName="PersonID" /> </MappingFragment> </EntityTypeMapping> </EntitySetMapping> <EntitySetMapping Name="Role"> <EntityTypeMapping TypeName="IsTypeOf(TestModel.Role)"> <MappingFragment StoreEntitySet="Role"> <ScalarProperty Name="RoleID" ColumnName="RoleID" /> </MappingFragment> </EntityTypeMapping> </EntitySetMapping> <EntitySetMapping Name="Visitor"> <EntityTypeMapping TypeName="IsTypeOf(TestModel.Visitor)"> <MappingFragment StoreEntitySet="Visitor"> <ScalarProperty Name="RoleID" ColumnName="RoleID" /> <ScalarProperty Name="OrganizationID" ColumnName="OrganizationID" /> </MappingFragment> </EntityTypeMapping> </EntitySetMapping> <AssociationSetMapping Name="FK_EXTERNALROLE_ROLE" TypeName="TestModel.FK_EXTERNALROLE_ROLE" StoreEntitySet="ExternalRole"> <EndProperty Name="Role"> <ScalarProperty Name="RoleID" ColumnName="RoleID" /> </EndProperty> <EndProperty Name="ExternalRole"> <ScalarProperty Name="RoleID" ColumnName="RoleID" /> </EndProperty> </AssociationSetMapping> <AssociationSetMapping Name="FK_VISITOR_EXTERNALROLE" TypeName="TestModel.FK_VISITOR_EXTERNALROLE" StoreEntitySet="Visitor"> <EndProperty Name="ExternalRole"> <ScalarProperty Name="RoleID" ColumnName="RoleID" /> </EndProperty> <EndProperty Name="Visitor"> <ScalarProperty Name="RoleID" ColumnName="RoleID" /> </EndProperty> </AssociationSetMapping> <AssociationSetMapping Name="FK_ROLE_PERSON" TypeName="TestModel.FK_ROLE_PERSON" StoreEntitySet="Role"> <EndProperty Name="Person"> <ScalarProperty Name="PersonID" ColumnName="PersonID" /> </EndProperty> <EndProperty Name="Role"> <ScalarProperty Name="RoleID" ColumnName="RoleID" /> </EndProperty> </AssociationSetMapping> <EntitySetMapping Name="Organization"> <EntityTypeMapping TypeName="IsTypeOf(TestModel.Organization)"> <MappingFragment StoreEntitySet="Organization"> <ScalarProperty Name="OrganizationID" ColumnName="OrganizationID" /></MappingFragment></EntityTypeMapping></EntitySetMapping> <AssociationSetMapping Name="Visitor1" TypeName="TestModel.Visitor1" StoreEntitySet="Visitor"> <EndProperty Name="Organization"> <ScalarProperty Name="OrganizationID" ColumnName="OrganizationID" /></EndProperty> <EndProperty Name="ExternalRole"> <ScalarProperty Name="RoleID" ColumnName="RoleID" /></EndProperty> <Condition ColumnName="OrganizationID" IsNull="false" /></AssociationSetMapping></EntityContainerMapping> </Mapping> </edmx:Mappings> </edmx:Runtime> <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) --> <edmx:Designer xmlns="http://schemas.microsoft.com/ado/2007/06/edmx"> <edmx:Connection> <DesignerInfoPropertySet> <DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" /> </DesignerInfoPropertySet> </edmx:Connection> <edmx:Options> <DesignerInfoPropertySet> <DesignerProperty Name="ValidateOnBuild" Value="true" /> </DesignerInfoPropertySet> </edmx:Options> <!-- Diagram content (shape and connector positions) --> <edmx:Diagrams> <Diagram Name="Model_Test"> <EntityTypeShape EntityType="TestModel.ExternalRole" Width="1.5" PointX="5.25" PointY="0.875" Height="1.4279589843749998" IsExpanded="true" /> <EntityTypeShape EntityType="TestModel.Person" Width="1.5" PointX="2.875" PointY="3.125" Height="1.2636116536458333" IsExpanded="true" /> <EntityTypeShape EntityType="TestModel.Role" Width="1.5" PointX="3" PointY="0.875" Height="1.4279589843749998" IsExpanded="true" /> <EntityTypeShape EntityType="TestModel.Visitor" Width="1.5" PointX="7.5" PointY="0.875" Height="1.4279589843749998" IsExpanded="true" /> <AssociationConnector Association="TestModel.FK_EXTERNALROLE_ROLE" ManuallyRouted="false"> <ConnectorPoint PointX="4.5" PointY="1.5889794921874998" /> <ConnectorPoint PointX="5.25" PointY="1.5889794921874998" /></AssociationConnector> <AssociationConnector Association="TestModel.FK_VISITOR_EXTERNALROLE" ManuallyRouted="false"> <ConnectorPoint PointX="6.75" PointY="1.5889794921874998" /> <ConnectorPoint PointX="7.5" PointY="1.5889794921874998" /></AssociationConnector> <AssociationConnector Association="TestModel.FK_ROLE_PERSON" ManuallyRouted="false"> <ConnectorPoint PointX="3.6875" PointY="3.125" /> <ConnectorPoint PointX="3.6875" PointY="2.3029589843749996" /></AssociationConnector> <EntityTypeShape EntityType="TestModel.Organization" Width="1.5" PointX="7.375" PointY="3.375" Height="1.2636116536458335" /> <AssociationConnector Association="TestModel.Visitor1" > <ConnectorPoint PointX="6" PointY="2.467306315104167" /> <ConnectorPoint PointX="6" PointY="4.0068058268229167" /> <ConnectorPoint PointX="7.375" PointY="4.0068058268229167" /></AssociationConnector></Diagram></edmx:Diagrams> </edmx:Designer> </edmx:Edmx>
I tried this:
- Create inheritance structure using base classes, deleting keys from subtypes and remapping.
Then I get following error:
Error 1 Error 11010: Association End 'ExternalRole' is not mapped. D:\Temp\WindowsFormsApplication1\WindowsFormsApplication1\Model_Test.edmx 135 11 WindowsFormsApplication1
Then I tried this:
- Deleted Visitor1 association from model
- Added new one using Add association dialog using Organization and Visitor ends
- Renamed Name and Association Set Name to FK_VISITOR_ORGANIZATION
When I tried to compile I get this error:
Error 1 Error 11008: Association 'FK_VISITOR_ORGANIZATION' is not mapped. D:\Temp\WindowsFormsApplication1\WindowsFormsApplication1\Model_Test.edmx 164 9 WindowsFormsApplication1
Then I tried this:
- Deleted OrganizationID field from Visitor
- For mapping details for 'FK_VISITOR_ORGANIZATION' I added mapping to Visitor
I ended with this model:
Now, is this ok? Am I doing something wrong from the start? What was wrong with starting model?<?xml version="1.0" encoding="utf-8"?> <edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"> <!-- EF Runtime content --> <edmx:Runtime> <!-- SSDL content --> <edmx:StorageModels> <Schema Namespace="TestModel.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="TestModelStoreContainer"> <EntitySet Name="ExternalRole" EntityType="TestModel.Store.ExternalRole" store:Type="Tables" Schema="dbo" /> <EntitySet Name="Organization" EntityType="TestModel.Store.Organization" store:Type="Tables" Schema="dbo" /> <EntitySet Name="Person" EntityType="TestModel.Store.Person" store:Type="Tables" Schema="dbo" /> <EntitySet Name="Role" EntityType="TestModel.Store.Role" store:Type="Tables" Schema="dbo" /> <EntitySet Name="Visitor" EntityType="TestModel.Store.Visitor" store:Type="Tables" Schema="dbo" /> <AssociationSet Name="FK_EXTERNALROLE_ROLE" Association="TestModel.Store.FK_EXTERNALROLE_ROLE"> <End Role="Role" EntitySet="Role" /> <End Role="ExternalRole" EntitySet="ExternalRole" /> </AssociationSet> <AssociationSet Name="FK_ROLE_PERSON" Association="TestModel.Store.FK_ROLE_PERSON"> <End Role="Person" EntitySet="Person" /> <End Role="Role" EntitySet="Role" /> </AssociationSet> <AssociationSet Name="FK_VISITOR_EXTERNALROLE" Association="TestModel.Store.FK_VISITOR_EXTERNALROLE"> <End Role="ExternalRole" EntitySet="ExternalRole" /> <End Role="Visitor" EntitySet="Visitor" /> </AssociationSet> <AssociationSet Name="FK_VISITOR_ORGANIZATION" Association="TestModel.Store.FK_VISITOR_ORGANIZATION"> <End Role="Organization" EntitySet="Organization" /> <End Role="Visitor" EntitySet="Visitor" /> </AssociationSet> </EntityContainer> <EntityType Name="ExternalRole"> <Key> <PropertyRef Name="RoleID" /> </Key> <Property Name="RoleID" Type="int" Nullable="false" /> </EntityType> <EntityType Name="Organization"> <Key> <PropertyRef Name="OrganizationID" /> </Key> <Property Name="OrganizationID" Type="int" Nullable="false" StoreGeneratedPattern="Identity" /> </EntityType> <EntityType Name="Person"> <Key> <PropertyRef Name="PersonID" /> </Key> <Property Name="PersonID" Type="int" Nullable="false" StoreGeneratedPattern="Identity" /> </EntityType> <EntityType Name="Role"> <Key> <PropertyRef Name="RoleID" /> </Key> <Property Name="RoleID" Type="int" Nullable="false" StoreGeneratedPattern="Identity" /> <Property Name="PersonID" Type="int" Nullable="false" /> </EntityType> <EntityType Name="Visitor"> <Key> <PropertyRef Name="RoleID" /> </Key> <Property Name="RoleID" Type="int" Nullable="false" /> <Property Name="OrganizationID" Type="int" Nullable="false" /> </EntityType> <Association Name="FK_EXTERNALROLE_ROLE"> <End Role="Role" Type="TestModel.Store.Role" Multiplicity="1"> <OnDelete Action="Cascade" /> </End> <End Role="ExternalRole" Type="TestModel.Store.ExternalRole" Multiplicity="0..1" /> <ReferentialConstraint> <Principal Role="Role"> <PropertyRef Name="RoleID" /> </Principal> <Dependent Role="ExternalRole"> <PropertyRef Name="RoleID" /> </Dependent> </ReferentialConstraint> </Association> <Association Name="FK_ROLE_PERSON"> <End Role="Person" Type="TestModel.Store.Person" Multiplicity="1"> <OnDelete Action="Cascade" /> </End> <End Role="Role" Type="TestModel.Store.Role" Multiplicity="*" /> <ReferentialConstraint> <Principal Role="Person"> <PropertyRef Name="PersonID" /> </Principal> <Dependent Role="Role"> <PropertyRef Name="PersonID" /> </Dependent> </ReferentialConstraint> </Association> <Association Name="FK_VISITOR_EXTERNALROLE"> <End Role="ExternalRole" Type="TestModel.Store.ExternalRole" Multiplicity="1"> <OnDelete Action="Cascade" /> </End> <End Role="Visitor" Type="TestModel.Store.Visitor" Multiplicity="0..1" /> <ReferentialConstraint> <Principal Role="ExternalRole"> <PropertyRef Name="RoleID" /> </Principal> <Dependent Role="Visitor"> <PropertyRef Name="RoleID" /> </Dependent> </ReferentialConstraint> </Association> <Association Name="FK_VISITOR_ORGANIZATION"> <End Role="Organization" Type="TestModel.Store.Organization" Multiplicity="1"> <OnDelete Action="Cascade" /> </End> <End Role="Visitor" Type="TestModel.Store.Visitor" Multiplicity="*" /> <ReferentialConstraint> <Principal Role="Organization"> <PropertyRef Name="OrganizationID" /> </Principal> <Dependent Role="Visitor"> <PropertyRef Name="OrganizationID" /> </Dependent> </ReferentialConstraint> </Association> </Schema></edmx:StorageModels> <!-- CSDL content --> <edmx:ConceptualModels> <Schema Namespace="TestModel" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2006/04/edm"> <EntityContainer Name="TestEntities"> <EntitySet Name="Person" EntityType="TestModel.Person" /> <EntitySet Name="Roles" EntityType="TestModel.Role" /> <AssociationSet Name="FK_ROLE_PERSON" Association="TestModel.FK_ROLE_PERSON"> <End Role="Person" EntitySet="Person" /> <End Role="Role" EntitySet="Roles" /> </AssociationSet> <EntitySet Name="Organizations" EntityType="TestModel.Organization" /> <AssociationSet Name="FK_VISITOR_ORGANIZATION" Association="TestModel.OrganizationVisitor"> <End Role="Organization" EntitySet="Organizations" /> <End Role="Visitor" EntitySet="Roles" /></AssociationSet></EntityContainer> <EntityType Name="ExternalRole" BaseType="TestModel.Role"> </EntityType> <EntityType Name="Person"> <Key> <PropertyRef Name="PersonID" /> </Key> <Property Name="PersonID" Type="Int32" Nullable="false" /> <NavigationProperty Name="Role" Relationship="TestModel.FK_ROLE_PERSON" FromRole="Person" ToRole="Role" /> </EntityType> <EntityType Name="Role"> <Key> <PropertyRef Name="RoleID" /> </Key> <Property Name="RoleID" Type="Int32" Nullable="false" /> <NavigationProperty Name="Person" Relationship="TestModel.FK_ROLE_PERSON" FromRole="Role" ToRole="Person" /> </EntityType> <EntityType Name="Visitor" BaseType="TestModel.ExternalRole"> <NavigationProperty Name="Organization" Relationship="TestModel.OrganizationVisitor" FromRole="Visitor" ToRole="Organization" /></EntityType> <Association Name="FK_ROLE_PERSON"> <End Role="Person" Type="TestModel.Person" Multiplicity="1"> <OnDelete Action="Cascade" /> </End> <End Role="Role" Type="TestModel.Role" Multiplicity="*" /> </Association> <EntityType Name="Organization"> <Key> <PropertyRef Name="OrganizationID" /></Key> <Property Name="OrganizationID" Type="Int32" Nullable="false" /> <NavigationProperty Name="Visitor" Relationship="TestModel.OrganizationVisitor" FromRole="Organization" ToRole="Visitor" /></EntityType> <Association Name="OrganizationVisitor"> <End Type="TestModel.Organization" Role="Organization" Multiplicity="1" /> <End Type="TestModel.Visitor" Role="Visitor" 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="TestModelStoreContainer" CdmEntityContainer="TestEntities"> <EntitySetMapping Name="Person"> <EntityTypeMapping TypeName="IsTypeOf(TestModel.Person)"> <MappingFragment StoreEntitySet="Person"> <ScalarProperty Name="PersonID" ColumnName="PersonID" /> </MappingFragment> </EntityTypeMapping> </EntitySetMapping> <EntitySetMapping Name="Roles"> <EntityTypeMapping TypeName="IsTypeOf(TestModel.Role)"> <MappingFragment StoreEntitySet="Role"> <ScalarProperty Name="RoleID" ColumnName="RoleID" /> </MappingFragment> </EntityTypeMapping> <EntityTypeMapping TypeName="IsTypeOf(TestModel.ExternalRole)"> <MappingFragment StoreEntitySet="ExternalRole"> <ScalarProperty Name="RoleID" ColumnName="RoleID" /> </MappingFragment> </EntityTypeMapping><EntityTypeMapping TypeName="IsTypeOf(TestModel.Visitor)"> <MappingFragment StoreEntitySet="Visitor"> <ScalarProperty Name="RoleID" ColumnName="RoleID" /> </MappingFragment> </EntityTypeMapping></EntitySetMapping> <AssociationSetMapping Name="FK_ROLE_PERSON" TypeName="TestModel.FK_ROLE_PERSON" StoreEntitySet="Role"> <EndProperty Name="Person"> <ScalarProperty Name="PersonID" ColumnName="PersonID" /> </EndProperty> <EndProperty Name="Role"> <ScalarProperty Name="RoleID" ColumnName="RoleID" /> </EndProperty> </AssociationSetMapping> <EntitySetMapping Name="Organizations"> <EntityTypeMapping TypeName="IsTypeOf(TestModel.Organization)"> <MappingFragment StoreEntitySet="Organization"> <ScalarProperty Name="OrganizationID" ColumnName="OrganizationID" /></MappingFragment></EntityTypeMapping></EntitySetMapping> <AssociationSetMapping Name="FK_VISITOR_ORGANIZATION" TypeName="TestModel.OrganizationVisitor" StoreEntitySet="Visitor"> <EndProperty Name="Visitor"> <ScalarProperty Name="RoleID" ColumnName="RoleID" /></EndProperty> <EndProperty Name="Organization"> <ScalarProperty Name="OrganizationID" ColumnName="OrganizationID" /></EndProperty></AssociationSetMapping></EntityContainerMapping> </Mapping> </edmx:Mappings> </edmx:Runtime> <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) --> <edmx:Designer xmlns="http://schemas.microsoft.com/ado/2007/06/edmx"> <edmx:Connection> <DesignerInfoPropertySet> <DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" /> </DesignerInfoPropertySet> </edmx:Connection> <edmx:Options> <DesignerInfoPropertySet> <DesignerProperty Name="ValidateOnBuild" Value="true" /> </DesignerInfoPropertySet> </edmx:Options> <!-- Diagram content (shape and connector positions) --> <edmx:Diagrams> <Diagram Name="Model_Test"> <EntityTypeShape EntityType="TestModel.ExternalRole" Width="1.5" PointX="5.25" PointY="0.875" Height="1.2636116536458335" IsExpanded="true" /> <EntityTypeShape EntityType="TestModel.Person" Width="1.5" PointX="2.875" PointY="3.125" Height="1.2636116536458333" IsExpanded="true" /> <EntityTypeShape EntityType="TestModel.Role" Width="1.5" PointX="3" PointY="0.875" Height="1.4279589843749998" IsExpanded="true" /> <EntityTypeShape EntityType="TestModel.Visitor" Width="1.5" PointX="7.5" PointY="0.875" Height="1.0992643229166668" IsExpanded="true" /> <AssociationConnector Association="TestModel.FK_ROLE_PERSON" ManuallyRouted="false"> <ConnectorPoint PointX="3.6875" PointY="3.125" /> <ConnectorPoint PointX="3.6875" PointY="2.3029589843749996" /></AssociationConnector> <EntityTypeShape EntityType="TestModel.Organization" Width="1.5" PointX="7.375" PointY="3.375" Height="1.2636116536458335" /> <InheritanceConnector EntityType="TestModel.ExternalRole"> <ConnectorPoint PointX="4.5" PointY="1.5068058268229168" /> <ConnectorPoint PointX="5.25" PointY="1.5068058268229168" /></InheritanceConnector> <InheritanceConnector EntityType="TestModel.Visitor" ManuallyRouted="false"> <ConnectorPoint PointX="6.75" PointY="1.34245849609375" /> <ConnectorPoint PointX="7.5" PointY="1.34245849609375" /></InheritanceConnector> <AssociationConnector Association="TestModel.OrganizationVisitor"> <ConnectorPoint PointX="8.1875" PointY="3.375" /> <ConnectorPoint PointX="8.1875" PointY="1.9742643229166668" /></AssociationConnector></Diagram></edmx:Diagrams> </edmx:Designer> </edmx:Edmx>
Greetings,
A.
- Anyone? :)
- I'm not getting any validation errors from your starting model. Your second model looks just fine, as well.
This posting is provided "AS IS" with no warranties, and confers no rights.


