<?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 : How to add to navigation property? (newbe q)</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2009 : How to add to navigation property? (newbe q)</description>
  <pubDate>Fri, 10 Apr 2026 21:42:24 -700</pubDate>
  <lastBuildDate>Wed, 07 Oct 2009 14:05:47 -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=1511</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>How to add to navigation property? (newbe q) : Well, you could do that, I suppose,...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1511&amp;PID=5596#5596</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=4" rel="nofollow">GregD</a><br /><strong>Subject:</strong> 1511<br /><strong>Posted:</strong> 07-Oct-2009 at 2:05pm<br /><br />Well, you could do that, I suppose, but I'm still puzzled as to the utility of eliminating the navigation property back to the parent.]]>
   </description>
   <pubDate>Wed, 07 Oct 2009 14:05:47 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1511&amp;PID=5596#5596</guid>
  </item> 
  <item>
   <title>How to add to navigation property? (newbe q) : Hi Greg,Steps to reproduce:1....</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1511&amp;PID=5594#5594</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=596" rel="nofollow">patrickdk</a><br /><strong>Subject:</strong> 1511<br /><strong>Posted:</strong> 07-Oct-2009 at 12:06pm<br /><br />Hi Greg,<br><br>Steps to reproduce:<br>1. Create a database containing the two tables + relationship<br>2. Create EF model (from db)<br>3. edit xml, throw out navigationproperty Order from CSDL section (from entitytype orderdetails)<br>4. create model with devforce object mapper<br>5. execute code<br><br>Whether I add to EntityManager before or after results in the same error.<br><br>I can send you a sample project if desired.<br>]]>
   </description>
   <pubDate>Wed, 07 Oct 2009 12:06:13 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1511&amp;PID=5594#5594</guid>
  </item> 
  <item>
   <title>How to add to navigation property? (newbe q) : Add the Order to the EntityManager...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1511&amp;PID=5593#5593</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=4" rel="nofollow">GregD</a><br /><strong>Subject:</strong> 1511<br /><strong>Posted:</strong> 07-Oct-2009 at 10:46am<br /><br />Add the Order to the EntityManager before attempting to add to its OrderDetails collection.<br><br>Incidentally, when I run your code the exception I get is an InvalidOperationException, with the (actually quite helpful) message:<br><br><i>&nbsp;&nbsp;&nbsp; Entities cannot be added to a RelatedEntityList belonging to a detached entity</i>.<br><br>Incidentally, it seems quite odd to have a one-way relationship Order-&gt;OrderDetails but no OrderDetail-&gt;Order.&nbsp; How do you model it?<br>]]>
   </description>
   <pubDate>Wed, 07 Oct 2009 10:46:26 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1511&amp;PID=5593#5593</guid>
  </item> 
  <item>
   <title>How to add to navigation property? (newbe q) : Hi, I&amp;#039;m new to Devforce,...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1511&amp;PID=5590#5590</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=596" rel="nofollow">patrickdk</a><br /><strong>Subject:</strong> 1511<br /><strong>Posted:</strong> 07-Oct-2009 at 6:35am<br /><br /><P>Hi,</P><P>I'm new to Devforce, and trying to build my first app. What I'm trying is:</P><DIV>A domain model with two entities, Order and OrderDetail.</DIV><DIV>Order has an OrderDetails navigation property</DIV><DIV>OrderDetails does NOT have a navigation property to Order (I don't want all of my entities point to everything else)</DIV><DIV>&nbsp;</DIV><DIV>My code looks like this:</DIV><DIV><FONT color=#0000ff size=2><FONT color=#0000ff size=2><P>var</FONT></FONT><FONT size=2> em = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>new</FONT></FONT><FONT size=2> DomainModel.</FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>DomainModelEntityManager</FONT></FONT><FONT size=2>(</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>true</FONT></FONT><FONT size=2>);</P><FONT size=2><DIV><FONT color=#0000ff>var<FONT size=2> </FONT></FONT><FONT size=2>d = em.CreateEntity&lt;DomainModel.</FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>OrderDetail</FONT></FONT><FONT size=2>&gt;();</FONT></DIV><DIV><FONT color=#666666>// set detail properties (...)</FONT></DIV><DIV>d.EntityAspect.AddToManager();</DIV><DIV>&nbsp;</DIV><DIV><DIV><FONT color=#0000ff size=2>var</FONT><FONT size=2>&nbsp;o = em.CreateEntity&lt;DomainModel.</FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>Order</FONT></FONT><FONT size=2>&gt;();</FONT></DIV><DIV><FONT color=#666666>// set order properties (...)</FONT></DIV><DIV><FONT size=2>o.OrderDetails.Add(d);</FONT></DIV><DIV><FONT size=2>o.EntityAspect.AddToManager();</FONT></DIV><DIV><FONT size=2></FONT>&nbsp;</DIV><DIV><FONT size=2>em.SaveAsync(savedcallbackhandler, <FONT color=#0000ff>null</FONT>);</FONT></DIV><DIV><FONT size=2></FONT>&nbsp;</DIV><DIV><FONT size=2>I'm getting a <FONT color=#ff0000>NullReferenceException </FONT>on o.OrderDetails.Add(d)</FONT></DIV><DIV><FONT size=2></FONT>&nbsp;</DIV><DIV><FONT size=2>What am I doing wrong?</FONT></DIV><DIV><FONT size=2></FONT>&nbsp;</DIV><DIV><FONT size=2>TIA,</FONT></DIV><DIV><FONT size=2></FONT>&nbsp;</DIV><DIV><FONT size=2>Patrick</DIV></FONT></FONT></FONT></DIV></DIV>]]>
   </description>
   <pubDate>Wed, 07 Oct 2009 06:35:17 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1511&amp;PID=5590#5590</guid>
  </item> 
 </channel>
</rss>