<?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 : POCO Merge Failure after Save</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : POCO Merge Failure after Save</description>
  <pubDate>Sat, 11 Apr 2026 15:19:09 -700</pubDate>
  <lastBuildDate>Wed, 08 Sep 2010 12:07:10 -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=2134</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>POCO Merge Failure after Save : Yes, the correct entity is updated...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2134&amp;PID=8401#8401</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=838" rel="nofollow">rhaney</a><br /><strong>Subject:</strong> 2134<br /><strong>Posted:</strong> 08-Sep-2010 at 12:07pm<br /><br /><FONT face="Verdana, Arial, Helvetica, sans-serif">Yes, the correct entity is updated during the save procedure in my PocoSaveAdapter class.</FONT><DIV>&nbsp;</DIV><DIV><FONT size=2>I can retrieve these POCO objects, modify them at the client, verify the entity state has changed, and persist the changes via the SaveChanges method.&nbsp; At some point after the changes have been saved, the EM throws an exception on the client side (see the above exception).</FONT></DIV><DIV>&nbsp;</DIV><DIV>I have a method defined as follows:</DIV><DIV>&nbsp;</DIV><DIV><FONT size=2 face="Verdana, Arial, Helvetica, sans-serif"><EM>public void UpdateCustomField(CustomField current, CustomField original)</EM></FONT></DIV><DIV><FONT size=2 face="Verdana, Arial, Helvetica, sans-serif"></FONT>&nbsp;</DIV><DIV><FONT size=2 face="Verdana, Arial, Helvetica, sans-serif">If I set a breakpoint at the beginning of this method, both "current" and "original" are fully populated objects, with the same ID.&nbsp; This method executes without exceptions.&nbsp; After updating and receiving the exception, if I restart my application I can pull up the entity and verify the changes were persisted.</FONT></DIV><DIV><FONT size=2></FONT>&nbsp;</DIV><DIV><FONT size=2>The DevForce internal&nbsp;post save client-side&nbsp;merge operation is failing for POCO objects only.&nbsp; If I don't modify a POCO object, everything works as expected.</FONT></DIV><DIV><FONT size=2 face="Verdana, Arial, Helvetica, sans-serif"></FONT>&nbsp;</DIV><DIV><FONT size=2><FONT face="Verdana, Arial, Helvetica, sans-serif">It might be worth noting that I couldn't get an EntityServerPocoSaveAdapter implementation to be discovered, but the convention based approach outlined in the wiki at </FONT><a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/POCOSupportInDevForce" target="_blank"><FONT face="Verdana, Arial, Helvetica, sans-serif">http://drc.ideablade.com/xwiki/bin/view/Documentation/POCOSupportInDevForce</FONT></A><FONT face="Verdana, Arial, Helvetica, sans-serif">&nbsp;worked.</FONT></FONT></DIV><DIV><FONT size=2 face="Verdana, Arial, Helvetica, sans-serif"></FONT>&nbsp;</DIV><DIV><FONT face=C&#111;nsolas><FONT size=2 face="Verdana, Arial, Helvetica, sans-serif">I'd prefer the EntityServerPocoSaveAdapter approach, due to the BeforeSave and AfterSave overrides.</FONT></DIV></FONT>]]>
   </description>
   <pubDate>Wed, 08 Sep 2010 12:07:10 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2134&amp;PID=8401#8401</guid>
  </item> 
  <item>
   <title>POCO Merge Failure after Save : Have you initialized the value...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2134&amp;PID=8400#8400</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> 2134<br /><strong>Posted:</strong> 08-Sep-2010 at 11:28am<br /><br />Have you initialized the value of the id field?]]>
   </description>
   <pubDate>Wed, 08 Sep 2010 11:28:20 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2134&amp;PID=8400#8400</guid>
  </item> 
  <item>
   <title>POCO Merge Failure after Save : FYI, this exception is raised...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2134&amp;PID=8386#8386</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=838" rel="nofollow">rhaney</a><br /><strong>Subject:</strong> 2134<br /><strong>Posted:</strong> 07-Sep-2010 at 2:17pm<br /><br />FYI, this exception is raised in 6.0.4 and 6.0.5.]]>
   </description>
   <pubDate>Tue, 07 Sep 2010 14:17:21 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2134&amp;PID=8386#8386</guid>
  </item> 
  <item>
   <title>POCO Merge Failure after Save : I&amp;#039;ve created a simple POCO...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2134&amp;PID=8385#8385</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=838" rel="nofollow">rhaney</a><br /><strong>Subject:</strong> 2134<br /><strong>Posted:</strong> 07-Sep-2010 at 2:15pm<br /><br />I've created a simple POCO class to support user defined fields in my DevForce application.&nbsp; I can get instances of the POCO class into the UI, and push updates back to the server via the SaveChanges method, but an exception is always raised&nbsp;<strong>on the client side</strong> after my PocoSaveAdapter executes.<DIV>&nbsp;</DIV><DIV>My POCO&nbsp;object is pretty simple:</DIV><DIV>&nbsp;</DIV><DIV>CustomField</DIV><DIV>&nbsp; int : Id</DIV><DIV>&nbsp; string : Name</DIV><DIV>&nbsp; string : Value</DIV><DIV>&nbsp;</DIV><DIV>Id is marked with the &#091;Key&#093; attribute.</DIV><DIV>&nbsp;</DIV><DIV>Is there something I am missing?</DIV><DIV>&nbsp;</DIV><DIV><strong>Here is the exception:</strong></DIV><DIV>&nbsp;</DIV><DIV>IdeaBlade.EntityModel.EntityManagerSaveException: EntityManager merge failure: Object reference not set to an instance of an object. ---&gt; System.NullReferenceException: Object reference not set to an instance of an object.<BR>&nbsp;&nbsp; at IdeaBlade.Core.MemberInfoFns.BuildPropertySet(PropertyInfo property)<BR>&nbsp;&nbsp; at IdeaBlade.EntityModel.EntityProperty.get_SetFunc()<BR>&nbsp;&nbsp; at IdeaBlade.EntityModel.PocoEntityWrapper.CopyValues(Object sourceEntity, Object destEntity)<BR>&nbsp;&nbsp; at IdeaBlade.EntityModel.PocoEntityWrapper.ReplaceCurrentOnLoadCore(EntityWrapper sourceWrapper)<BR>&nbsp;&nbsp; at IdeaBlade.EntityModel.EntityWrapper.ReplaceCurrentOnLoad(EntityWrapper sourceEntity)<BR>&nbsp;&nbsp; at IdeaBlade.EntityModel.EntityWrapper.LoadEntity(EntityWrapper sourceWrapper, MergeStrategy mergeStrategy)<BR>&nbsp;&nbsp; at IdeaBlade.EntityModel.EntityGroup.LoadEntity(EntityWrapper sourceWrapper, MergeStrategy mergeStrategy, Boolean&amp; rowUpdated)<BR>&nbsp;&nbsp; at IdeaBlade.EntityModel.EntityMerger.MergeEntityCore(EntityWrapper sourceWrapper, EntityGroup targetEntityGroup)<BR>&nbsp;&nbsp; at IdeaBlade.EntityModel.EntityMerger.MergeEntity(EntityWrapper sourceWrapper, EntityGroup targetEntityGroup, NavigationContext context)<BR>&nbsp;&nbsp; at IdeaBlade.EntityModel.EntityMerger.&lt;&gt;c__DisplayClass1.&lt;MergeEntities&gt;b__0(EntityWrapper sourceWrapper)<BR>&nbsp;&nbsp; at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()<BR>&nbsp;&nbsp; at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)<BR>&nbsp;&nbsp; at System.Linq.Enumerable.ToList&#091;TSource&#093;(IEnumerable`1 source)<BR>&nbsp;&nbsp; at IdeaBlade.EntityModel.EntityMerger.Merge(IEnumerable`1 sourceEntityWrappersGroupedByType, NavigationContext context)<BR>&nbsp;&nbsp; at IdeaBlade.EntityModel.EntityMerger.Merge(EntityManager targetManager, IEnumerable`1 sourceEntityWrappersGroupedByType, MergeStrategy mergeStrategy, MergeType mergeType)<BR>&nbsp;&nbsp; at IdeaBlade.EntityModel.EntityManager.SaveEntitiesPostProcessing(SaveWorkState workState)<BR>&nbsp;&nbsp; --- End of inner exception stack trace ---<BR>&nbsp;&nbsp; at IdeaBlade.EntityModel.AsyncProcessor`1.&lt;&gt;c__DisplayClass2.&lt;.ctor&gt;b__0(TArgs args)<BR>&nbsp;&nbsp; at IdeaBlade.EntityModel.AsyncProcessor`1.Signal()<BR>&nbsp;&nbsp; at IdeaBlade.EntityModel.AsyncProcessor`1.&lt;Execute&gt;b__5(Object x)&nbsp;&nbsp;&nbsp;&nbsp; </DIV><DIV>Line: 56<BR>Char: 13<BR>Code: 0</DIV>]]>
   </description>
   <pubDate>Tue, 07 Sep 2010 14:15:11 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2134&amp;PID=8385#8385</guid>
  </item> 
 </channel>
</rss>