<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : ImportEntities can&#039;t find related 1..0 or 1 entity</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2009 : ImportEntities can&#039;t find related 1..0 or 1 entity</description>
  <pubDate>Wed, 29 Apr 2026 00:52:21 -700</pubDate>
  <lastBuildDate>Mon, 28 Dec 2009 13:42:20 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=1594</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>ImportEntities can&#039;t find related 1..0 or 1 entity : The PK for DealCost should be...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1594&amp;PID=5995#5995</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=23" rel="nofollow">davidklitzke</a><br /><strong>Subject:</strong> 1594<br /><strong>Posted:</strong> 28-Dec-2009 at 1:42pm<br /><br /><P =Ms&#111;normal><SPAN style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">The PK for DealCost should be the same value as the PK for Deal, and I’m not sure why it’s 0.&nbsp; If you do something like the following:<?: prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P><P =Ms&#111;normal><SPAN style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p></o:p></SPAN></P><P =Ms&#111;normal><SPAN style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">&nbsp; Deal deal = em.CreateEntity&lt;Deal&gt;();<o:p></o:p></SPAN></P><P =Ms&#111;normal><SPAN style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">&nbsp;// … set deal property values</P><DIV></SPAN><SPAN style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">Ddeal.AddToManager();<o:p></o:p></SPAN></DIV><P =Ms&#111;normal><SPAN style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p></o:p></SPAN></P><P =Ms&#111;normal><SPAN style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">&nbsp; DealCost dealCost = em.CreateEntity&lt;DealCost&gt;();<o:p></o:p></SPAN></P><P =Ms&#111;normal><SPAN style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">&nbsp; <B>dealCost.Deal = deal;<o:p></o:p></B></SPAN></P><P =Ms&#111;normal><SPAN style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">&nbsp; // … set other dealCost values<o:p></o:p></SPAN></P><P =Ms&#111;normal><SPAN style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">&nbsp; dealCost.AddToManager();<o:p></o:p></SPAN></P><P =Ms&#111;normal><SPAN style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p></o:p></SPAN></P><P =Ms&#111;normal><SPAN style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">… then deal.DealId should equal dealCost.DealId.&nbsp; Since it doesn’t – can we see the code snippet for how these entities are created to see what might be going wrong?<o:p></o:p></SPAN></P><P =Ms&#111;normal><SPAN style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>]]>
   </description>
   <pubDate>Mon, 28 Dec 2009 13:42:20 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1594&amp;PID=5995#5995</guid>
  </item> 
  <item>
   <title>ImportEntities can&#039;t find related 1..0 or 1 entity :  &amp;lt;AssociationSet Name=&amp;#034;Deal_DealCostSet&amp;#034;...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1594&amp;PID=5979#5979</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=308" rel="nofollow">skingaby</a><br /><strong>Subject:</strong> 1594<br /><strong>Posted:</strong> 23-Dec-2009 at 9:45am<br /><br /><table width="99%"><tr><td><pre class="BBcode">&lt;AssociationSet Name="Deal_DealCostSet" Association="Png.GcsAg.Model.ServerModelEF.Deal_DealCost"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;End Role="Deal" EntitySet="Deals" /&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;End Role="DealCost" EntitySet="DealCosts" /&gt;<br />&lt;/AssociationSet&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  <br />In Deal:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  <br />&lt;NavigationProperty Name="DealCost" Relationship="Png.GcsAg.Model.ServerModelEF.Deal_DealCost" FromRole="Deal" ToRole="DealCost" /&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />In DealCost:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&lt;NavigationProperty Name="Deal" Relationship="Png.GcsAg.Model.ServerModelEF.Deal_DealCost" FromRole="DealCost" ToRole="Deal" /&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  <br />&lt;Association Name="Deal_DealCost"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;End Role="Deal" Type="Png.GcsAg.Model.ServerModelEF.Deal" Multiplicity="1"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;OnDelete Action="Cascade" /&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/End&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;End Role="DealCost" Type="Png.GcsAg.Model.ServerModelEF.DealCost" Multiplicity="0..1" /&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ReferentialConstraint&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Principal Role="Deal"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  &lt;PropertyRef Name="DealId" /&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/Principal&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Dependent Role="DealCost"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  &lt;PropertyRef Name="DealId" /&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/Dependent&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/ReferentialConstraint&gt;<br />&lt;/Association&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&lt;AssociationSetMapping Name="Deal_DealCostSet" TypeName="Png.GcsAg.Model.ServerModelEF.Deal_DealCost" StoreEntitySet="DEAL_COSTs"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;EndProperty Name="Deal"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  &lt;ScalarProperty Name="DealId" ColumnName="DEAL_ID" /&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/EndProperty&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;EndProperty Name="DealCost"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  &lt;ScalarProperty Name="DealId" ColumnName="DEAL_ID" /&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/EndProperty&gt;<br />&lt;/AssociationSetMapping&gt;</pre></td></tr></table><br /><br />The configuration of the relationship looks right in the EDMX.<br /><br />The Storage entity does not have the StoreGeneratedPattern="Identity" tag on the Key property.  Should it?<br /><br />&lt;EntityType Name="DEAL_COST"&gt;<br />&lt;Key&gt;<br />&lt;PropertyRef Name="DEAL_ID" /&gt;<br />&lt;/Key&gt;<br />&lt;Property Name="DEAL_ID" Type="int64" Nullable="false" /&gt;<br />&lt;Property Name="COST" Type="decimal" /&gt;<br />&lt;Property Name="DEAL_COST_TYPE_ID" Type="int64" /&gt;<br />]]>
   </description>
   <pubDate>Wed, 23 Dec 2009 09:45:29 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1594&amp;PID=5979#5979</guid>
  </item> 
  <item>
   <title>ImportEntities can&#039;t find related 1..0 or 1 entity : Wethink there&#8217;s a problem with...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1594&amp;PID=5974#5974</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=23" rel="nofollow">davidklitzke</a><br /><strong>Subject:</strong> 1594<br /><strong>Posted:</strong> 22-Dec-2009 at 10:44am<br /><br /><P =Ms&#111;normal><SPAN style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">We&nbsp;think there’s a problem with the Ids, since the key of DealCost is 0 yet the EM is expecting -100.&nbsp; We’d recommend that you first check the relationships to ensure they’re actually set up as expected.<?: prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>]]>
   </description>
   <pubDate>Tue, 22 Dec 2009 10:44:13 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1594&amp;PID=5974#5974</guid>
  </item> 
  <item>
   <title>ImportEntities can&#039;t find related 1..0 or 1 entity : I have a Deal Entity, it has 1...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1594&amp;PID=5960#5960</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=308" rel="nofollow">skingaby</a><br /><strong>Subject:</strong> 1594<br /><strong>Posted:</strong> 21-Dec-2009 at 8:46am<br /><br />I have a Deal Entity, it has 1 or more DealPricings and it may or may not have a single DealCost entity depending on Deal.DealType.<br />We are using a federated persistence context with late instantiation.  All of our entities are in a MainPersistenceContext that the grid UI is bound to.  However, when we save a row, we spin up a temporarySaveContext, import the row's dirty entities into that temporarySaveContext and then call EntityManager.SaveChangesAsync.<br /><br />If I add a Deal with a DealPricing, and save, it works fine.<br />But if I add a Deal with a DealPricing AND a DealCost, the EntityManager.ImportEntities fails:<br />An entity containing a referenced temporary Id is missing from the list of entities provided. DealCost: -100 was not found.<br /><br />The entities collection being imported has the following keys:<br />Deal (-100)<br />DealPricing (-101)<br />DealCost (0)<br /><br />Thanks, Simon.<br />]]>
   </description>
   <pubDate>Mon, 21 Dec 2009 08:46:56 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1594&amp;PID=5960#5960</guid>
  </item> 
 </channel>
</rss>