none
Error 111 on Association

    Question

  • Two tables:

    Table1 - Locations PK=(SiteID, LocationID)
    Table2 - Customers PK=(SiteID, CustomerID), FK=(SiteID, LocationID), LocationID is NULLABLE

    I'm trying to create an association between Locations and Customers.  We partition the database using SiteID (users at each store can only see their data based on the SiteID).  So SiteID is on every table and is part of every PK.

    Here's the association in the CSDL: 
    <Association Name="LocationItemCustomerItem">
    
    
    
    <End Type="db.LocationItem" Role="LocationItem" Multiplicity ="1"/>
    
    
    
    <End Type="db.CustomerItem" Role="CustomerItem" Multiplicity="*" />
    
    
    
    <ReferentialConstraint>
    
    
    
    <Principal Role="LocationItem">
    
    
    
    <PropertyRef Name="SiteID" />
    
    
    
    <PropertyRef Name="LocationID" />
    
    
    
    </Principal>
    
    
    
    <Dependent Role="CustomerItem">
    
    
    
    <PropertyRef Name="SiteID" />
    
    
    
    <PropertyRef Name="LocationID"/>
    
    
    
    </Dependent>
    
    
    
    </ReferentialConstraint>
    
    
    
    </Association>
    I get the following error:


    Error 20 Error 111: Properties referred by the Dependent Role CustomerItem must be a subset of the key of the EntityType db.CustomerItem referred to by the Dependent Role in the referential constraint for Relationship db.LocationItemCustomerItem. 

    Any suggestions?
    • Edited by bap3 Sunday, June 14, 2009 2:16 PM
    Saturday, June 13, 2009 6:15 PM

All replies

  • does anyone have suggestions to my original post?

    I'm running Entity Framework in .Net Framework 3.5 SP1.

    Tuesday, June 16, 2009 1:42 AM
  • bump...anybody????
    Thursday, June 18, 2009 2:45 AM
  • double bump.  help would be much appreciated ... anyone???
    Tuesday, June 23, 2009 5:49 PM
  • I have a similar issue, I have a working service, but when I try and hook Linqpad it gets a Metadataexception 111 with the same issue as above. We are on .NET 4
    Mike Walker MVP - Visual Developer VSTO - Please mark the best replies as Answers ! Owner and CTO FWBS Ltd http://www.fwbs.net Twitter: www.twitter.com/mikewalker74
    Thursday, December 23, 2010 9:30 AM
  • Any news about how to fix or work around this bug?

    We have the same problem on VS2012 and this really is a blocker ...

    Tuesday, January 28, 2014 10:13 AM