<?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 : Possible Bug - Import entities</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Possible Bug - Import entities</description>
  <pubDate>Tue, 14 Apr 2026 10:15:00 -700</pubDate>
  <lastBuildDate>Fri, 20 Jan 2012 14:19:41 -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=2596</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>Possible Bug - Import entities : Thanks for the sample smi-dan....</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=12512#12512</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> 2596<br /><strong>Posted:</strong> 20-Jan-2012 at 2:19pm<br /><br />Thanks for the sample smi-dan. That's why I couldn't repro it. This issue is fixed in 6.1.5.<span style="font-size:10px"><br /><br />Edited by DenisK - 20-Jan-2012 at 2:20pm</span>]]>
   </description>
   <pubDate>Fri, 20 Jan 2012 14:19:41 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=12512#12512</guid>
  </item> 
  <item>
   <title>Possible Bug - Import entities : Hi DenisK,I&amp;#039;ve gone ahead...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=12501#12501</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1059" rel="nofollow">smi-dan</a><br /><strong>Subject:</strong> 2596<br /><strong>Posted:</strong> 19-Jan-2012 at 9:12pm<br /><br />Hi DenisK,&nbsp;<div><br></div><div>I've gone ahead and created a sample project that demonstrates the issue.&nbsp;</div><div><br></div><div><a href="uploads/1059/RestoreCacheStateExample.zip" target="_blank">uploads/1059/RestoreCacheStateExample.zip</a><br></div><div><br></div><div>You'll note that the Note.Text makes it through the RestoreCacheState but none of the ComplexType properties make it through.</div><div><br></div><div>I am using DevForce 6.1.4.0</div>]]>
   </description>
   <pubDate>Thu, 19 Jan 2012 21:12:11 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=12501#12501</guid>
  </item> 
  <item>
   <title>Possible Bug - Import entities : Hi smi-dan,No, that&amp;#039;s not...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=12499#12499</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> 2596<br /><strong>Posted:</strong> 19-Jan-2012 at 3:28pm<br /><br /><div>Hi smi-dan,</div><div><br></div>No, that's not the intended behavior. We have tests here that cover this scenario and they all pass. If you can send me your edmx containing only the Note entity and its Audit complex type, I'll try to repro it here. Please let me know as well the version of DevForce you're using.<div><br></div><div>Thank you.</div>]]>
   </description>
   <pubDate>Thu, 19 Jan 2012 15:28:57 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=12499#12499</guid>
  </item> 
  <item>
   <title>Possible Bug - Import entities : Following on from this thread...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=12496#12496</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1059" rel="nofollow">smi-dan</a><br /><strong>Subject:</strong> 2596<br /><strong>Posted:</strong> 19-Jan-2012 at 1:42pm<br /><br /><div style="margin-left: 1px; margin-top: 1px; margin-right: 1px; margin-bottom: 1px; 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; border-: initial; -: n&#111;ne; ">Following on from this thread - the code we ended up using for our Merge method is as follows;&nbsp;<div><br></div><div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sourceRepository.Manager.FindEntities&lt;Entity&gt;(EntityState.Added)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .ForEach(e =&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;e.EntityAspect.AcceptChanges();</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;e.EntityAspect.SetModified();</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;});</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var restoreStrategy = new RestoreStrategy(false, false, MergeStrategy.OverwriteChanges);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var data = sourceRepository.Manager.CacheStateManager.GetCacheState();</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Manager.CacheStateManager.RestoreCacheState(data, restoreStrategy);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Manager.FindEntities&lt;Entity&gt;(EntityState.Modified)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .Where(e =&gt; (int)e.EntityAspect.EntityKey.Values&#091;0&#093; &lt; 0)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .ForEach(e =&gt; e.EntityAspect.EntityState = EntityState.Added);</div></div><div><br></div><div><br></div><div>We have a Note entity which has a complex type Audit. After GetCacheState() the EntityCacheState preserves the state of Audit however after the call to RestoreCacheState() Audit's properties are null.&nbsp;</div><div><br></div><div>Is this a bug with RestoreCacheState or intended behavior? Is there a way to preserve the state of Audit?</div></div>]]>
   </description>
   <pubDate>Thu, 19 Jan 2012 13:42:44 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=12496#12496</guid>
  </item> 
  <item>
   <title>Possible Bug - Import entities : Sounds good.Both issues should...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=12008#12008</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> 2596<br /><strong>Posted:</strong> 03-Nov-2011 at 7:29pm<br /><br />Sounds good.<div><br></div><div>Both issues should be fixed in 6.1.4. They're currently marked as priority.</div>]]>
   </description>
   <pubDate>Thu, 03 Nov 2011 19:29:35 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=12008#12008</guid>
  </item> 
  <item>
   <title>Possible Bug - Import entities : I don&amp;#039;t need a patch right...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=12007#12007</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=449" rel="nofollow">smi-mark</a><br /><strong>Subject:</strong> 2596<br /><strong>Posted:</strong> 03-Nov-2011 at 7:26pm<br /><br />I don't need a patch right away, my workaround seems to do the trick for now. I simply delete any modified entities after a save. <br><br>Thanks for looking into it, much appreciated. Will this and the the deletion merging issue be fixed in 6.1.4?<br><br><br>]]>
   </description>
   <pubDate>Thu, 03 Nov 2011 19:26:21 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=12007#12007</guid>
  </item> 
  <item>
   <title>Possible Bug - Import entities : Ok, this is not a bug. And my...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=12005#12005</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> 2596<br /><strong>Posted:</strong> 03-Nov-2011 at 6:38pm<br /><br />Ok, this is not a bug. And my statement&nbsp;<div><br></div><div>"<span ="Apple-style-span" style=": rgb251, 251, 253; ">If you leave it as "Modified" it will still insert a new entity (after id fixup) to the database."</span></div><div><span ="Apple-style-span" style=": rgb251, 251, 253; "><br></span></div><div><span ="Apple-style-span" style=": rgb251, 251, 253; ">is completely false. I had mentioned this as well in my earlier post. I was pretty sure I tested this which is why I posted it in the first place. But I guess between the importing and changing of EntityState, I must have confused myself. My apologies.</span></div><div><span ="Apple-style-span" style=": rgb251, 251, 253; "><br></span></div><div><span ="Apple-style-span" style=": rgb251, 251, 253; ">On the other hand, I was able to duplicate issue #2 where after calling save, the original "Added" entity with the negative temp id still exists. I've filed a bug report. Please let me know if you require a patch. I apologize again if this takes longer than anticipated.</span></div>]]>
   </description>
   <pubDate>Thu, 03 Nov 2011 18:38:50 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=12005#12005</guid>
  </item> 
  <item>
   <title>Possible Bug - Import entities : Yes, this happens during SaveChanges...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=12004#12004</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=449" rel="nofollow">smi-mark</a><br /><strong>Subject:</strong> 2596<br /><strong>Posted:</strong> 03-Nov-2011 at 4:07pm<br /><br />Yes, this happens during SaveChanges and using the latest 6.1.3.1]]>
   </description>
   <pubDate>Thu, 03 Nov 2011 16:07:42 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=12004#12004</guid>
  </item> 
  <item>
   <title>Possible Bug - Import entities : This sounds like a bug. Does this...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=12003#12003</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> 2596<br /><strong>Posted:</strong> 03-Nov-2011 at 3:49pm<br /><br />This sounds like a bug. Does this happen upon SaveChanges? Also, what version are you using?]]>
   </description>
   <pubDate>Thu, 03 Nov 2011 15:49:05 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=12003#12003</guid>
  </item> 
  <item>
   <title>Possible Bug - Import entities : If I don&amp;#039;t set it back to...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=11988#11988</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=449" rel="nofollow">smi-mark</a><br /><strong>Subject:</strong> 2596<br /><strong>Posted:</strong> 02-Nov-2011 at 2:43pm<br /><br />If I don't set it back to Added, it causes an error, at least under fake context, saying it can't find the entity.<br><br>"Unable to locate entity within the 'Fake' entity server: DealerAddress: -101"<br>]]>
   </description>
   <pubDate>Wed, 02 Nov 2011 14:43:40 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=11988#11988</guid>
  </item> 
  <item>
   <title>Possible Bug - Import entities : Hi smi-mark;It&amp;#039;s been a while...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=11987#11987</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> 2596<br /><strong>Posted:</strong> 02-Nov-2011 at 1:21pm<br /><br />Hi smi-mark;<div><br></div><div>It's been a while since we last discussed on this issue. I've read the whole posts again so let me try to summarize the issue(s).</div><div><br></div><div>I think we're dealing with 2 different issues here.</div><div><br></div><div>1. Best practices of using sandbox editor with 2 EntityManagers via ImportEntities.</div><div><br></div><div>As I recall, it is by design that if you have a new "Added" entity with a negative temp id and you're importing it to a second EM and importing it back to the original EM, it will create a duplicate entity because an "Added" entity with a negative temp id is always considered a new entity. The workaround is to set this entity to a "Modified" state before importing it back to the original EM.</div><div><br></div><div>The workaround that you show above seems pretty reasonable except for one thing. Why did you have to set&nbsp;</div><div><pre style="text-align: left; : rgb251, 251, 253; font-family: C&#111;nsolas; ">entities.ForEach(e&nbsp;=&gt;&nbsp;e.EntityAspect.SetAdded());</pre></div><div>after importing it back to the original EM? If you leave it as "Modified" it will still insert a new entity (after id fixup) to the database.</div><div><br></div><div>For best practices suggestions, you might want to read this blog post by Ward on using DevForce with Sandbox editors, if you haven't.&nbsp;<a href="http://neverindoubtnet.blogspot.com/2010/12/sandbox-editors-with-clientui-c&#111;ntacts.html" target="_blank">http://neverindoubtnet.blogspot.com/2010/12/sandbox-editors-with-clientui-contacts.html</a></div><div><br></div><div>2. The new "Added" entities get duplicated in the EM after saving.</div><div><br></div><div>I think this is the bug that I tried to track down last we talked. You had sent me an SL solution that showed this bug but I couldn't repro it outside that solution. Would you be able to provide a console repro for this?</div><div><br></div><div><br></div><div><br></div>]]>
   </description>
   <pubDate>Wed, 02 Nov 2011 13:21:28 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=11987#11987</guid>
  </item> 
  <item>
   <title>Possible Bug - Import entities :   This is what I&amp;#039;ve had...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=11976#11976</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=449" rel="nofollow">smi-mark</a><br /><strong>Subject:</strong> 2596<br /><strong>Posted:</strong> 01-Nov-2011 at 4:52pm<br /><br />This is what I've had to do to make things work. It's not pretty, but it works.<br><br>When I load a sandboxed editor up I merge the data in like this:<br><br><pre style="font-family:C&#111;nsolas;font-size:13;color:black;:white;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OriginalManager.FindEntities&lt;<span style="color:#2b91af;">Entity</span>&gt;(<span style="color:#2b91af;">EntityState</span>.Added)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.ForEach(e&nbsp;=&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.EntityAspect.AcceptChanges();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.EntityAspect.SetModified();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">var</span>&nbsp;restoreStrategy&nbsp;=&nbsp;<span style="color:blue;">new</span>&nbsp;<span style="color:#2b91af;">RestoreStrategy</span>(<span style="color:blue;">false</span>,&nbsp;<span style="color:blue;">false</span>,&nbsp;<span style="color:#2b91af;">MergeStrategy</span>.OverwriteChanges);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">var</span>&nbsp;data&nbsp;=&nbsp;repositoryBase.Manager.CacheStateManager.GetCacheState();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NewManager.CacheStateManager.RestoreCacheState(data,&nbsp;restoreStrategy); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">var</span>&nbsp;entities&nbsp;=&nbsp;Manager.FindEntities&lt;<span style="color:#2b91af;">Entity</span>&gt;(<span style="color:#2b91af;">EntityState</span>.Modified)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.Where(e&nbsp;=&gt;&nbsp;(<span style="color:blue;">int</span>)e.EntityAspect.EntityKey.Values&#091;0&#093;&nbsp;&lt;&nbsp;0).ToList(); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;entities.ForEach(e&nbsp;=&gt;&nbsp;e.EntityAspect.SetAdded());<br><br>To stop the new manager from assigning a new Id, I have to call AcceptChanges and then SetModified.<br><br>Since I am using integer primary keys, I can find the true "Added" entities by finding the ones with a negative key. I then set these back to Added in the new manager.<br>Also, to get around duplicating the same negative key, I have had to alter the default ID generator. It now uses a static _nextId variable so that all instances use the same id counter.<br><br>This seems to work, the only issue is on saving where even though they are set to added, they get duplicated in the EM after saving, the original Added entities, and the new saved unchanged entities.<br><br>I have had to do this to get around it:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:blue;">private</span>&nbsp;<span style="color:blue;">void</span>&nbsp;OnSaveSuccess()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">var</span>&nbsp;addedEntities&nbsp;=&nbsp;Manager.FindEntities(<span style="color:#2b91af;">EntityState</span>.Added)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.OfType&lt;<span style="color:#2b91af;">Entity</span>&gt;()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.ToList(); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">for</span>&nbsp;(<span style="color:blue;">var</span>&nbsp;i&nbsp;=&nbsp;addedEntities.Count-1;&nbsp;i&nbsp;&gt;=&nbsp;0;&nbsp;i--)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;addedEntities<em>.EntityAspect.Delete();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>If there is a better/cleaner way of doing this, I'm all ears.<br></em></pre><em><br></em><span style="font-size:10px"><br /><br />Edited by smi-mark - 01-Nov-2011 at 5:00pm</span>]]>
   </description>
   <pubDate>Tue, 01 Nov 2011 16:52:33 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=11976#11976</guid>
  </item> 
  <item>
   <title>Possible Bug - Import entities : Hey Denis,I&amp;#039;m back on this...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=11966#11966</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=449" rel="nofollow">smi-mark</a><br /><strong>Subject:</strong> 2596<br /><strong>Posted:</strong> 31-Oct-2011 at 3:17pm<br /><br />Hey Denis,<br><br>I'm back on this project again and need some help. I have it "working" by doing this:<br><br>Calling EntityAspect.AcceptChanges() then EntityAspect.SetModified()<br><br>Then in the server save interceptor <br><br><pre style="font-family:C&#111;nsolas;font-size:13;color:black;:white;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">protected</span>&nbsp;<span style="color:blue;">override</span>&nbsp;<span style="color:blue;">bool</span>&nbsp;ExecuteSave()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">var</span>&nbsp;entities&nbsp;=&nbsp;<span style="color:blue;">this</span>.EntityManager&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.FindEntities(<span style="color:#2b91af;">EntityState</span>.Modified)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.OfType&lt;<span style="color:#2b91af;">Entity</span>&gt;()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.ToList(); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">foreach</span>&nbsp;(<span style="color:blue;">var</span>&nbsp;entity&nbsp;<span style="color:blue;">in</span>&nbsp;entities)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">var</span>&nbsp;key&nbsp;=&nbsp;(<span style="color:blue;">int</span>)&nbsp;entity.EntityAspect.EntityKey.Values&#091;0&#093;; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">if</span>&nbsp;(key&nbsp;&lt;&nbsp;0)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;entity.EntityAspect.SetAdded();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">return</span>&nbsp;<span style="color:blue;">base</span>.ExecuteSave();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>If I take out the accept/set modified code, when I merge the additions from one EM into another it duplicates. <br><br>Has there been any progress on resolving these issues?<br></pre><br>]]>
   </description>
   <pubDate>Mon, 31 Oct 2011 15:17:48 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=11966#11966</guid>
  </item> 
  <item>
   <title>Possible Bug - Import entities : I appreciate the help Mark. Thanks!...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10853#10853</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> 2596<br /><strong>Posted:</strong> 27-May-2011 at 12:02pm<br /><br />I appreciate the help Mark. Thanks!]]>
   </description>
   <pubDate>Fri, 27 May 2011 12:02:25 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10853#10853</guid>
  </item> 
  <item>
   <title>Possible Bug - Import entities : I can try and come up with a console...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10848#10848</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=449" rel="nofollow">smi-mark</a><br /><strong>Subject:</strong> 2596<br /><strong>Posted:</strong> 26-May-2011 at 7:13pm<br /><br />I can try and come up with a console based example that reproduces it. This was originally happening in another project and I made this to reproduce it.]]>
   </description>
   <pubDate>Thu, 26 May 2011 19:13:35 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10848#10848</guid>
  </item> 
  <item>
   <title>Possible Bug - Import entities : Yes, you&amp;#039;re correct. SaveChanges...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10839#10839</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> 2596<br /><strong>Posted:</strong> 26-May-2011 at 3:36pm<br /><br />Yes, you're correct. SaveChanges will not pick those entities up when you use AcceptChanges. So in the broader scenario, SetModified is probably preferable. All the more reason for me to figure out why I can't repro the above issue outside the solution. It should be as simple as importing the same modified entity again but it doesn't generate duplicate in my test project when I do that.]]>
   </description>
   <pubDate>Thu, 26 May 2011 15:36:08 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10839#10839</guid>
  </item> 
  <item>
   <title>Possible Bug - Import entities : Hi Denis,Thanks for the update....</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10837#10837</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=449" rel="nofollow">smi-mark</a><br /><strong>Subject:</strong> 2596<br /><strong>Posted:</strong> 26-May-2011 at 3:14pm<br /><br />Hi Denis,<br><br>Thanks for the update. I'm not sure if my workaround works in all cases, but I will retest it again when I get chance.<br><br>The only problem with AcceptChanges(), is that now they are unmodified, so a call to SaveChanges() won't pick those entities up will it?<br><br><br>]]>
   </description>
   <pubDate>Thu, 26 May 2011 15:14:55 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10837#10837</guid>
  </item> 
  <item>
   <title>Possible Bug - Import entities : Hi Mark;Sorry it took so long...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10836#10836</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> 2596<br /><strong>Posted:</strong> 26-May-2011 at 3:12pm<br /><br /><div>Hi Mark;</div><div><br></div><div>Sorry it took so long to get back. Since you've already found a workaround, this has probably become a non issue for you.</div><div><br></div><div>Anyway, I just want to follow up what I found. It may or may not be useful.</div><div><br></div><div>The sample you sent does indicate that calling .SetModified() doesn't work. But the strange thing is that, when the EntityState is first Added, then SetModified(), the ImportEntities works. It will update the temp id from -100 to -101 and update the original CustomerAddress. However, when I modify the address again, ImportEntities stops working, i.e. it will keep the -101 CustomerAddress and create a new -102 CustomerAddress. What's even stranger is that I can't repro it outside the solution.</div><div><br></div><div>If I modify the code slightly to the following, using AcceptChanges(), then ImportEntities will keep the original temp id and not create duplicate CustomerAddress.</div><div><br></div><div><table width="99%"><tr><td><pre class="BBcode"></div><div><div>&nbsp; &nbsp; vm.EntityManager</div><div>&nbsp; &nbsp; &nbsp; &nbsp; .FindEntities(EntityState.Added | EntityState.Modified)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; //.FindEntities(EntityState.Added)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .OfType&lt;Entity&gt;()</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .ForEach(entity =&gt; entity.EntityAspect.AcceptChanges());</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //.ForEach(entity =&gt; entity.EntityAspect.SetModified());</div><div><br></div><div>&nbsp; &nbsp; &nbsp;var entities = vm.EntityManager</div><div>&nbsp; &nbsp; &nbsp; &nbsp; //.FindEntities(EntityState.AnyAddedModifiedOrDeleted)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; .FindEntities(EntityState.AllButDetached)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .OfType&lt;Entity&gt;();</div><div>&nbsp; &nbsp; &nbsp;_primaryEntityManager.ImportEntities(entities, MergeStrategy.OverwriteChanges);</div></div><div></pre></td></tr></table></div><div><br></div><div>I'll continue to investigate this and provide updates when I've found something useful. But, again, as you've found a workaround, I think this issue can be considered closed.</div>]]>
   </description>
   <pubDate>Thu, 26 May 2011 15:12:12 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10836#10836</guid>
  </item> 
  <item>
   <title>Possible Bug - Import entities : Thank you Mark. Appreciate the...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10702#10702</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> 2596<br /><strong>Posted:</strong> 16-May-2011 at 12:02pm<br /><br />Thank you Mark. Appreciate the help. I'll get back in touch once I take a look at the sample.]]>
   </description>
   <pubDate>Mon, 16 May 2011 12:02:42 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10702#10702</guid>
  </item> 
  <item>
   <title>Possible Bug - Import entities :  Hi Derick,I have prepared a...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10699#10699</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=449" rel="nofollow">smi-mark</a><br /><strong>Subject:</strong> 2596<br /><strong>Posted:</strong> 16-May-2011 at 11:38am<br /><br />Hi Derick,<br><br>I have prepared a sample. I have put the zip on our webserver:<br><br>http://71.164.192.3/ImportSL.zip<br><br>I have not used any frameworks with this sample, so it's not all best practices!<br><br>You will see two 'screens'<br><br>the top is the customer screen that lets you add/edit an address, when you click one of these buttons you will be able to update the address screen.<br><br>If you edit the address and save it, then save and edit again, you will see it starts duplicating the data. You will see it is not merging it in properly.<br><br>If you have any questions on it please let me know. <br><br>Thanks,<br><br>Mark<br>]]>
   </description>
   <pubDate>Mon, 16 May 2011 11:38:52 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10699#10699</guid>
  </item> 
  <item>
   <title>Possible Bug - Import entities : Hi Denis,I have had to work on...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10645#10645</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=449" rel="nofollow">smi-mark</a><br /><strong>Subject:</strong> 2596<br /><strong>Posted:</strong> 11-May-2011 at 12:45pm<br /><br />Hi Denis,<br><br>I have had to work on a couple other projects recently, I will get back to this and create an example showing what I mean.<br><br>Thanks,<br><br>Mark<br>]]>
   </description>
   <pubDate>Wed, 11 May 2011 12:45:33 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10645#10645</guid>
  </item> 
  <item>
   <title>Possible Bug - Import entities : Hi smi-mark;I just want to follow...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10644#10644</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> 2596<br /><strong>Posted:</strong> 11-May-2011 at 12:36pm<br /><br />Hi smi-mark;<div><br></div><div>I just want to follow up again on this to make sure that there isn't any other bug.&nbsp;</div><div><br></div><div>The code snippet in your last post seems to be similar to what I'm doing in my testing but I'm still having a hard time understanding when you said "<span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px; ">"<span ="apple-style-span"="" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px; ">Using AcceptChanges or SetModified by it self didn't work".</span></span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px; "><span ="apple-style-span"="" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px; "><br></span></span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px; "><span ="apple-style-span"="" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px; ">I would appreciate it if you can clarify that to me so I know all the bugs related to this that could be discovered are discovered.</span></span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px; "><span ="apple-style-span"="" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px; "><br></span></span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px; "><span ="apple-style-span"="" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px; ">Thanks!</span></span></div>]]>
   </description>
   <pubDate>Wed, 11 May 2011 12:36:05 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10644#10644</guid>
  </item> 
  <item>
   <title>Possible Bug - Import entities : Thanks for sharing your solution...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10528#10528</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> 2596<br /><strong>Posted:</strong> 25-Apr-2011 at 11:48am<br /><br />Thanks for sharing your solution smi-mark.&nbsp;<div><br></div><div>Could you clarify what you meant by&nbsp;"<span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px; ">Using AcceptChanges or SetModified by it self didn't work" ?</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px; "><br></span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px; ">What do you mean by itself and what didn't work?</span></div>]]>
   </description>
   <pubDate>Mon, 25 Apr 2011 11:48:34 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10528#10528</guid>
  </item> 
  <item>
   <title>Possible Bug - Import entities :  Hi Denis,Using AcceptChanges...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10524#10524</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=449" rel="nofollow">smi-mark</a><br /><strong>Subject:</strong> 2596<br /><strong>Posted:</strong> 22-Apr-2011 at 11:20am<br /><br />Hi Denis,<br><br>Using AcceptChanges or SetModified by it self didn't work, but I do seem to have a solution:<br><br>I create a list of entities from EM2 with a state of Added, call AcceptChanges, import to EM1<br><br>For each Added Entity in EM2 i find the Entity using FindEntity EntityKey in EM1 and call SetAdded on it, this keeps the temporary Id and seems to work.<br><br><table width="99%"><tr><td class="BBquote"><br><pre style="font-family:C&#111;nsolas;font-size:13;color:black;:white;"><span style="color:blue;">var</span>&nbsp;addedEntities&nbsp;=&nbsp;fromManager.FindEntities(<span style="color:#2b91af;">EntityState</span>.Added)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.OfType&lt;<span style="color:#2b91af;">Entity</span>&gt;()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.ToList(); addedEntities.ForEach(e&nbsp;=&gt;&nbsp;e.EntityAspect.AcceptChanges());toManager.ImportEntities(addedEntities,&nbsp;<span style="color:#2b91af;">MergeStrategy</span>.OverwriteChanges); addedEntities.Select(entity&nbsp;=&gt;&nbsp;toManager.FindEntity(entity.EntityAspect.EntityKey)&nbsp;<span style="color:blue;">as</span>&nbsp;<span style="color:#2b91af;">Entity</span>)              .ForEach(e&nbsp;=&gt;&nbsp;e.EntityAspect.SetAdded());</pre><br></td></tr></table><br><span style="font-size:10px"><br /><br />Edited by smi-mark - 22-Apr-2011 at 11:21am</span>]]>
   </description>
   <pubDate>Fri, 22 Apr 2011 11:20:40 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10524#10524</guid>
  </item> 
  <item>
   <title>Possible Bug - Import entities : Hi Denis,Perfect, if that is the...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10497#10497</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=449" rel="nofollow">smi-mark</a><br /><strong>Subject:</strong> 2596<br /><strong>Posted:</strong> 20-Apr-2011 at 3:46pm<br /><br />Hi Denis,<br><br>Perfect, if that is the case then that will work fine.<br><br>Thanks for looking into it.<br>]]>
   </description>
   <pubDate>Wed, 20 Apr 2011 15:46:50 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10497#10497</guid>
  </item> 
  <item>
   <title>Possible Bug - Import entities : Hi smi-mark;If the new &amp;#034;modified&amp;#034;...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10490#10490</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> 2596<br /><strong>Posted:</strong> 20-Apr-2011 at 1:53pm<br /><br /><div>Hi smi-mark;</div><div><br></div><div>If the new "modified" entity still has a temp id, upon call to SaveChanges, EntityManager will do an id fixup and insert that new entity into the database. It will not update an existing entity in the database.</div><div><br></div><div>As I've mentioned before, you could also call AcceptChanges on CustomerAddress before EM2 saves/merges the entity back into EM1. I believe this will work better since you can call RejectChanges to roll back any Modified entity back to its Unchanged state.</div>]]>
   </description>
   <pubDate>Wed, 20 Apr 2011 13:53:34 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10490#10490</guid>
  </item> 
  <item>
   <title>Possible Bug - Import entities : Hi Denis,I need to test this,...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10480#10480</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=449" rel="nofollow">smi-mark</a><br /><strong>Subject:</strong> 2596<br /><strong>Posted:</strong> 19-Apr-2011 at 1:33pm<br /><br />Hi Denis,<br><br>I need to test this, but in a "modified" state, won't they try to update in the database rather than inserting them? These are new entities that have not yet been saved. <br><br>This is being used in a sandbox scenario such as this:<br><br>Customer - EM 1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Customer Address Edit - EM 2<br><br>When EM 2 "saves" it does not really save, it simply merges back into EM 1. EM 1 is responsible for saving of any changes.<br><br>I am doing it like this to simulate the old checkpointing ability in DevForce classic. <br>]]>
   </description>
   <pubDate>Tue, 19 Apr 2011 13:33:30 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10480#10480</guid>
  </item> 
  <item>
   <title>Possible Bug - Import entities :   Hi smi-mark;I&amp;#039;ve discussed...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10479#10479</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> 2596<br /><strong>Posted:</strong> 19-Apr-2011 at 1:08pm<br /><br />Hi smi-mark;<div><br></div><div>I've discussed the issue regarding importing entity with an Added state and temp id resulting in a duplicate entity with the lead developer and confirmed that this is the correct behavior.</div><div><br></div><div>The reason is that, when the entity is still in the Added state and has a temp id, EntityManager still considers it as a new entity and so when another same entity with the same temp id is also imported, EM will consider that entity a "new" entity and assigns it a new temp id.</div><div><br></div><div>The workaround by setting that entity to Modified, (calling AcceptChanges will work as well), is correct because we're telling the EntityManager that the entity is no longer new as we have "touched" it.</div><div><br></div><div>Please let me know if you still have further questions. I will post more updates on the PropertyChanged issue when I have some.</div><span style="font-size:10px"><br /><br />Edited by DenisK - 19-Apr-2011 at 1:10pm</span>]]>
   </description>
   <pubDate>Tue, 19 Apr 2011 13:08:57 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10479#10479</guid>
  </item> 
  <item>
   <title>Possible Bug - Import entities : Thanks again smi-mark. This is...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10365#10365</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> 2596<br /><strong>Posted:</strong> 01-Apr-2011 at 4:38pm<br /><br />Thanks again smi-mark. This is really helpful.]]>
   </description>
   <pubDate>Fri, 01 Apr 2011 16:38:26 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10365#10365</guid>
  </item> 
  <item>
   <title>Possible Bug - Import entities :  I have found a workaround for...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10364#10364</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=449" rel="nofollow">smi-mark</a><br /><strong>Subject:</strong> 2596<br /><strong>Posted:</strong> 01-Apr-2011 at 3:51pm<br /><br />I have found a workaround for both problems. <br><br>For the first problem, as above, I just call it twice.<br><br>For the second problem, I do it like this:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public static void ImportFrom(this EntityManager manager, EntityManager fromManager)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var addedEntities = fromManager.FindEntities(EntityState.Added).OfType&lt;Entity&gt;().ToList();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fromManager.RemoveEntities(addedEntities);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; manager.ImportEntities(fromManager.FindEntities(EntityState.AllButDetached), MergeStrategy.OverwriteChanges);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; manager.AddEntities(addedEntities);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><span style="font-size:10px"><br /><br />Edited by smi-mark - 01-Apr-2011 at 4:16pm</span>]]>
   </description>
   <pubDate>Fri, 01 Apr 2011 15:51:15 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2596&amp;PID=10364#10364</guid>
  </item> 
 </channel>
</rss>