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.
- Edited by bap3 Sunday, June 14, 2009 2:16 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