<?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 : Best Practice for RejectChanges()/Undo behaviour?</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Best Practice for RejectChanges()/Undo behaviour?</description>
  <pubDate>Wed, 13 May 2026 21:24:57 -700</pubDate>
  <lastBuildDate>Tue, 06 Sep 2011 17:53: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=2927</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>Best Practice for RejectChanges()/Undo behaviour? : Thanks for the info Tim. Let&amp;#039;s...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2927&amp;PID=11633#11633</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 2927<br /><strong>Posted:</strong> 06-Sep-2011 at 5:53pm<br /><br /><span ="Apple-style-span" style="font-family: 'Times New Roman'; line-height: normal; font-size: medium; "><div style=": rgb255, 255, 255; margin-left: 1px; margin-top: 1px; margin-right: 1px; margin-bottom: 1px; font-family: Verdana, Arial, Helvetica, sans-serif; color: rgb0, 0, 0; font-size: 12px; line-height: 1.4; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; -: n&#111;ne; ">Thanks for the info Tim. Let's continue the conversation once you have gathered some time. I'll also keep a lookout if there are others who report similar issue.</div></span>]]>
   </description>
   <pubDate>Tue, 06 Sep 2011 17:53:15 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2927&amp;PID=11633#11633</guid>
  </item> 
  <item>
   <title>Best Practice for RejectChanges()/Undo behaviour? :   G&amp;#039;day Denis,Sorry for...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2927&amp;PID=11617#11617</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1155" rel="nofollow">Wokket</a><br /><strong>Subject:</strong> 2927<br /><strong>Posted:</strong> 01-Sep-2011 at 3:50pm<br /><br />G'day Denis,<div>&nbsp;</div><div>Sorry for the delay getting back to you, project work has been keeping me busy!</div><div>&nbsp;</div><div>I have not been able to consistently repro in a simple application on 6.1.0.0 either :(&nbsp; I've re-written the relevant portion of the application in our trunk to spin up a new EntityManage for this transaction to isolate the changes, and this has resolved the defect in-app.&nbsp;&nbsp; Unfortunately we're going to go-live with this defect in place as the risk from the re-write is too large at this stage of the project.</div><div>&nbsp;</div><div>We're not doing any cloning in our codebase, but dupes are invovled.&nbsp; When the item re-attaches itself we generally see it added as a duplicate (bug D1809), although this resolved itself after the upgrade to 6.1.2.&nbsp; Unfortunately this same upgrade seemed to have some perf issues merging large numbers of entities into a new EntityManager (our reference data) compared to 6.1.0, but I haven't had a chance to really get tht sorted/evaluated yet.</div><div>&nbsp;</div><div>Given the complexities of running the two versions side-by-side (see my thread here: <a href="http://www.ideablade.com/forum/forum_posts.asp?TID=2939" target="_blank">http://www.ideablade.com/forum/forum_posts.asp?TID=2939</a>) we're staying on 6.1.0 until go-live in a few weeks time, and once it's bedded in we'll look again at rolling our ongoing dev to the latest build.</div><div>&nbsp;</div><div>Ta,</div><div>Tim</div>]]>
   </description>
   <pubDate>Thu, 01 Sep 2011 15:50:23 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2927&amp;PID=11617#11617</guid>
  </item> 
  <item>
   <title>Best Practice for RejectChanges()/Undo behaviour? : Hi Tim;I just want to give you...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2927&amp;PID=11615#11615</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 2927<br /><strong>Posted:</strong> 01-Sep-2011 at 3:23pm<br /><br /><span ="Apple-style-span" style="font-family: 'Times New Roman'; line-height: normal; font-size: medium; "><div style=": rgb255, 255, 255; margin-left: 1px; margin-top: 1px; margin-right: 1px; margin-bottom: 1px; font-family: Verdana, Arial, Helvetica, sans-serif; color: rgb0, 0, 0; font-size: 12px; line-height: 1.4; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; -: n&#111;ne; ">Hi Tim;<div><br></div><div>I just want to give you an update. I took your ViewModel code and I'm still unable to repro. I attempted to repro using WPF 2-tier and n-tier, as well as in Silverlight using both 6.1.0 and 6.1.2.&nbsp;</div><div><br></div><div>I wonder if UI plays some part here.</div><div><br></div><div>We've also had a similar bug report in which a duplicate entity can occur after a SaveChanges when you clone the original entity, remove the original entity from the manager and you add the clone entity and save it. I wonder if you're doing something similar to this in your full app?</div><div><br></div><div>Have you also had any luck in reverting to earlier version and creating a consistent simple repro?</div><div><br></div><div>Any other clue you can give us will be helpful as well.</div><div><br></div><div>Thanks,</div><div>Denis</div></div></span><span style="font-size:10px"><br /><br />Edited by DenisK - 01-Sep-2011 at 3:24pm</span>]]>
   </description>
   <pubDate>Thu, 01 Sep 2011 15:23:35 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2927&amp;PID=11615#11615</guid>
  </item> 
  <item>
   <title>Best Practice for RejectChanges()/Undo behaviour? : Hi Tim;Thanks for the ViewModel...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2927&amp;PID=11601#11601</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 2927<br /><strong>Posted:</strong> 30-Aug-2011 at 7:03pm<br /><br />Hi Tim;<div><br></div><div>Thanks for the ViewModel code. Let me take a look and see if I can get something out of it.</div>]]>
   </description>
   <pubDate>Tue, 30 Aug 2011 19:03:21 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2927&amp;PID=11601#11601</guid>
  </item> 
  <item>
   <title>Best Practice for RejectChanges()/Undo behaviour? :    HiI&amp;#039;ve had to move...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2927&amp;PID=11573#11573</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=770" rel="nofollow">GeorgeB</a><br /><strong>Subject:</strong> 2927<br /><strong>Posted:</strong> 29-Aug-2011 at 10:45pm<br /><br />Hi<div>&nbsp;</div><div>I've had to move to using Guids for my 3&nbsp;main transaction tables to overcome this and it's working without any issues.</div><div>&nbsp;</div><div>I wish I had more time to spend on this but I have deadlines for 31st August. I'm battling with a HttpTimoutWithoutDetails.</div><div>&nbsp;</div><div>Kr</div><div>George</div><span style="font-size:10px"><br /><br />Edited by GeorgeB - 29-Aug-2011 at 10:53pm</span>]]>
   </description>
   <pubDate>Mon, 29 Aug 2011 22:45:26 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2927&amp;PID=11573#11573</guid>
  </item> 
  <item>
   <title>Best Practice for RejectChanges()/Undo behaviour? :   G&amp;#039;day all,It looks like...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2927&amp;PID=11567#11567</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1155" rel="nofollow">Wokket</a><br /><strong>Subject:</strong> 2927<br /><strong>Posted:</strong> 29-Aug-2011 at 1:52pm<br /><br />G'day all,<div>&nbsp;</div><div>It looks like its not as clear cut as I'd hoped, as the issue still occurring at times under 6.1.2.&nbsp; I have a repro app which generated the error once, but I can't make it fail again.&nbsp; I'm also in silverlight/using Async calls etc.</div><div>&nbsp;</div><div>I can generate the failure in my full solution pretty consistently, but not 100%, and trying the get the error to surface in a simple app is proving troublesome.&nbsp; I'll revert my machine to v6.1.0 shortly, and try and get a consistent simple repro with the earlier version.</div><div>&nbsp;</div><div>In the meantime, I've attached the simple silverlight ViewModel I'm using for your perusal.</div><div>&nbsp;</div><div><a href="uploads/1155/MainPageViewModel.txt" target="_blank">uploads/1155/MainPageViewModel.txt</a></div><div>&nbsp;</div><div>Cheers,</div><div>Tim</div>]]>
   </description>
   <pubDate>Mon, 29 Aug 2011 13:52:54 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2927&amp;PID=11567#11567</guid>
  </item> 
  <item>
   <title>Best Practice for RejectChanges()/Undo behaviour? :  Hi Tim;Thanks for the clarification....</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2927&amp;PID=11564#11564</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 2927<br /><strong>Posted:</strong> 29-Aug-2011 at 11:33am<br /><br />Hi Tim;<div><br></div><div>Thanks for the clarification. Just so the 3 of us (George, me and you) to be on the same page, would you be so kind to share your repro that you said you did under 6.1.0?</div><div><br></div><div>George has 6.1.3.0d and he says that he's seeing a similar issue so I'm wondering whether it is the same issue or not since your upgrade to 6.1.2 seems to have fixed it.</div><div><br></div><div>Thank you,</div><div>Denis</div><span style="font-size:10px"><br /><br />Edited by DenisK - 29-Aug-2011 at 11:35am</span>]]>
   </description>
   <pubDate>Mon, 29 Aug 2011 11:33:09 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2927&amp;PID=11564#11564</guid>
  </item> 
  <item>
   <title>Best Practice for RejectChanges()/Undo behaviour? :   G&amp;#039;day all,I can confirm...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2927&amp;PID=11556#11556</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1155" rel="nofollow">Wokket</a><br /><strong>Subject:</strong> 2927<br /><strong>Posted:</strong> 28-Aug-2011 at 1:48pm<br /><br />G'day all,<div>&nbsp;</div><div>I can confirm that upgrading from 6.1.0 to 6.1.2 appears to have solved our issue... I can no longer repro it the same as I could under 6.1.0 anyway.</div><div>&nbsp;</div><div>I'll re-post in here if it pops again under production load.</div><div>&nbsp;</div><div>Cheers,</div><div>Tim</div>]]>
   </description>
   <pubDate>Sun, 28 Aug 2011 13:48:55 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2927&amp;PID=11556#11556</guid>
  </item> 
  <item>
   <title>Best Practice for RejectChanges()/Undo behaviour? : Hi George;Thanks for the feedback....</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2927&amp;PID=11551#11551</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 2927<br /><strong>Posted:</strong> 26-Aug-2011 at 5:28pm<br /><br />Hi George;<div><br></div><div>Thanks for the feedback. I've tried to repro again with 6.1.3.0d but I'm still unsuccessful. My repro is perhaps too simplistic and there's probably something more going on that I can't see.</div><div><br></div><div>I've attached my test solution here. Would you please take a look and try to isolate the issue using this solution?</div><div><br></div><div><a href="uploads/912/TestSoluti&#111;n.zip" target="_blank">uploads/912/TestSolution.zip</a><br></div><div><br></div><div>Thank you,</div><div>Denis</div>]]>
   </description>
   <pubDate>Fri, 26 Aug 2011 17:28:59 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2927&amp;PID=11551#11551</guid>
  </item> 
  <item>
   <title>Best Practice for RejectChanges()/Undo behaviour? :     Hi DenisI&amp;#039;m seeingvery...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2927&amp;PID=11539#11539</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=770" rel="nofollow">GeorgeB</a><br /><strong>Subject:</strong> 2927<br /><strong>Posted:</strong> 25-Aug-2011 at 10:53pm<br /><br />Hi Denis<div>&nbsp;</div><div>I'm seeing&nbsp;very similar issues with my Silverlight application. I have version 6.1.3.0d</div><div>&nbsp;</div><div>I add a new entity but during my business process I may need to reject it before saving. Later when a new entity is added I&nbsp;get an error saying that entity -100 exists.</div><div>&nbsp;</div><div>For now I'm moving these entities to Guids and my problems are gone.</div><div>&nbsp;</div><div>Kr</div><div>George</div><span style="font-size:10px"><br /><br />Edited by GeorgeB - 25-Aug-2011 at 11:10pm</span>]]>
   </description>
   <pubDate>Thu, 25 Aug 2011 22:53:56 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2927&amp;PID=11539#11539</guid>
  </item> 
  <item>
   <title>Best Practice for RejectChanges()/Undo behaviour? : Hi Tim;Actually, there&amp;#039;s...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2927&amp;PID=11538#11538</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 2927<br /><strong>Posted:</strong> 25-Aug-2011 at 8:13pm<br /><br />Hi Tim;<div><br></div><div>Actually, there's nothing wrong with how you're using RejectChanges. I suspect that there is a bug at play here.</div><div><br></div><div>When RejectChanges is called, an Added entity will be removed from its EntityManager and marked as Detached. Detached means that it is not associated with any EntityManager.&nbsp;Therefore, the call EntityAspect.RemoveFromManager should not be necessary.</div><div><br></div><div>However, I'm having no luck in reproducing the issue here.</div><div><br></div><div>1. What version are you using? I'll attempt my repro using this version. It might be an already fixed bug.</div><div><br></div><div>2. Will it be possible for you to isolate this in a simple console solution and send it to me?</div>]]>
   </description>
   <pubDate>Thu, 25 Aug 2011 20:13:25 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2927&amp;PID=11538#11538</guid>
  </item> 
  <item>
   <title>Best Practice for RejectChanges()/Undo behaviour? :   G&amp;#039;day all,This is both...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2927&amp;PID=11530#11530</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1155" rel="nofollow">Wokket</a><br /><strong>Subject:</strong> 2927<br /><strong>Posted:</strong> 25-Aug-2011 at 3:43pm<br /><br />G'day all,<div>&nbsp;</div><div>This is both a general request for 'best-practise' devforce design, and also a specific question about my current scenario.</div><div>&nbsp;</div><div>How would you recommend devforce be used/managed to support user-cancellation of complex edits?</div><div>&nbsp;</div><div>In our app as currently designed, we have a small, fixed number of EntityManager's that are created and loaded with cached reference data at application startup.&nbsp; When a user requests an edit we load the required item, Include()'ing the relevant child data, and relying on the cached reference data to auto-attach those entities.... this works perfectly!</div><div>&nbsp;</div><div>If the user makes some changes to the item (I'll talk a normal Order -&gt; OrderDetails scenario), say changing an orderdate, and then chooses to cancel their edit, we call the RejectChanges() method, and the date rolls back exactly as expected.</div><div>&nbsp;</div><div>However we run into problems with adding new child items (eg, an OrderDetail), and then cancelling changes.... these items seem to remain in the EntityCache or similar in a detached state, with their generated -100 id.&nbsp; This causes problems if we (for example):</div><div>&nbsp;</div><div>1. Pop a new Order/OrderDetails set of data</div><div>2. Cancel Changes</div><div>3. Make some other save that resets the generated ID's back to -100</div><div>4. Another pop of a new item results in the earlier OrderDetails magically coming back to life and attaching themselves to the new Order.&nbsp; Other symptoms include errors regarding multiple items with the same (-100 based) ID as the id's are recycled after the save.</div><div>&nbsp;</div><div>We've been playing with specifically removing items from the EntityManager after rejecting the changes eg:</div><div>_cxt.RejectChanges; //Model state goes from Added to Detached</div><div>if (Model.EntityState == EntityState.Detached) //was freshly added until we cancelled</div><div>{</div><div>&nbsp;&nbsp;&nbsp;&nbsp; Model.EntityAspect.RemoveFromManager(true); //Remove from the cache, don't try and save it later on</div><div>}</div><div>&nbsp;</div><div>And this has definately reduced the number of issues we're seeing, but it isn't sufficient for all our scenarios (hence the general request for your recommended approach above).</div><div>&nbsp;</div><div>If I can provide any more info please just ask.</div><div>Cheers,</div><div>Tim</div><div>&nbsp;</div>]]>
   </description>
   <pubDate>Thu, 25 Aug 2011 15:43:52 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2927&amp;PID=11530#11530</guid>
  </item> 
 </channel>
</rss>