<?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 : RejectChanges to Parent/Children</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : RejectChanges to Parent/Children</description>
  <pubDate>Sun, 12 Apr 2026 23:41:54 -700</pubDate>
  <lastBuildDate>Mon, 19 Dec 2011 15:08:15 -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=3163</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>RejectChanges to Parent/Children :   Hi Scott,To reject all entity...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3163&amp;PID=12273#12273</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=892" rel="nofollow">sbelini</a><br /><strong>Subject:</strong> 3163<br /><strong>Posted:</strong> 19-Dec-2011 at 3:08pm<br /><br />Hi Scott,<div>&nbsp;</div><div>To reject all entity changes made you should call mgr.RejectChanges. </div><div>&nbsp;</div><div>Note that this will roll back all entity changes since the cache was created or the last SaveChanges call was made, which might also roll back entity changes you don't want to.</div><div>&nbsp;</div><div>When calling RejectChanges on an entity rather than on the entityManager,&nbsp;the call&nbsp;will not propagate to the entity's children. You could, however, accomplish it by using reflection. In this case, you'd 'travel' thru the entire entity's hierarchy, rejecting changes to all its children. (and possibly grandchildren, etc, if needed)<br>That will, however, be a laborious because you'd need to navigate thru all the entities to call RejectChanges.<br><br>Before going that path I'd suggest using a "sandbox" EM where you could call mgr.RejectChanges() or simply save and then merge the EntityCache of the sandbox mgr with the main entity manager. You will find detailed information about this approach in the <a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/multiple-entitymanagers" target="_blank"><u><font color="#0066cc">DevForce Resource Center</font></u></a>.</div><div>&nbsp;</div><div>I hope this helps,</div><div>&nbsp;&nbsp; Silvio</div>]]>
   </description>
   <pubDate>Mon, 19 Dec 2011 15:08:15 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3163&amp;PID=12273#12273</guid>
  </item> 
  <item>
   <title>RejectChanges to Parent/Children :   I must be having a brain cell...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3163&amp;PID=12270#12270</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1120" rel="nofollow">scottarlp</a><br /><strong>Subject:</strong> 3163<br /><strong>Posted:</strong> 19-Dec-2011 at 6:20am<br /><br />I must be having a brain cell strike. If I have a parent entity such as Order and create a new Order and then attach new OrderDetail entities to the relation, how do I go about rejecting all of them? I had thought that calling RejectChanges() on Order would also take care of the OrderDetail (nothing commited, just added), but what I'm seeing are OrderDetail records dangling in cache waiting to be saved.<div>&nbsp;</div><div>I've got a generic Entity in my ViewModel for an edit dialog. It's not aware of the specific entity, so I call RejectChanges() on it if the user cancels. I was hoping I could keep this rather generic and possibly (if needed) cycle through any child relations and cancel them as well.</div><div>&nbsp;</div><div>Thanks for your help.</div><div>Scott</div>]]>
   </description>
   <pubDate>Mon, 19 Dec 2011 06:20:38 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3163&amp;PID=12270#12270</guid>
  </item> 
 </channel>
</rss>