<?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 : EntityAspect Changes in 6.1.3.1</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : EntityAspect Changes in 6.1.3.1</description>
  <pubDate>Mon, 13 Apr 2026 16:47:48 -700</pubDate>
  <lastBuildDate>Thu, 08 Dec 2011 11:51:25 -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=3128</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>EntityAspect Changes in 6.1.3.1 :   There have been several changes...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3128&amp;PID=12183#12183</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=11" rel="nofollow">kimj</a><br /><strong>Subject:</strong> 3128<br /><strong>Posted:</strong> 08-Dec-2011 at 11:51am<br /><br />There have been several changes to entity handling over the releases this year.&nbsp; Which version of DevForce were you using prior to 6.1.3.1?&nbsp; <div>&nbsp;</div><div>We did rationalize the behavior between creating an entity via CreateEntity and newing an entity.&nbsp; In both cases the entity is always Detached until added to an EntityManager.&nbsp; If actually added (via AddEntity or AddToManager) then it's state will then become Added; if it was instead attached (via AttachEntity) then it's state will become Unchanged.</div><div>&nbsp;</div><div>The Detached entity state means that the entity does not have an EntityManager.&nbsp; The null entity for an entity type is a kind of sentinel, it is always Detached and therefore never has an EntityManager.&nbsp;&nbsp; Your workaround for this change is reasonable;&nbsp; since you have a "myEntityManager" handy, you could call GetNullEntity on that instead if you wanted.</div><div>&nbsp;</div><div>An entity should never become detached after a save, unless it's previous state was Deleted.&nbsp; If you find this happening for inserts and updates then that could be a bug, and we'd need more information.&nbsp; After a successful save, all saved entities with a previous state of Added or Modified should now have an Unchanged state.</div><div>&nbsp;</div>]]>
   </description>
   <pubDate>Thu, 08 Dec 2011 11:51:25 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3128&amp;PID=12183#12183</guid>
  </item> 
  <item>
   <title>EntityAspect Changes in 6.1.3.1 : As of 6.1.3.1 there appear to...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3128&amp;PID=12170#12170</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=705" rel="nofollow">chuckc</a><br /><strong>Subject:</strong> 3128<br /><strong>Posted:</strong> 06-Dec-2011 at 3:00pm<br /><br /><p ="Ms&#111;normal">As of 6.1.3.1 there appear to be some different behaviorsintroduced regarding EntityState at various points in an entity lifecycle.&nbsp; Previously, an entity was UnChanged atcreate time – now it is Detached, and does not have anEntityAspect.EntityManger defined.&nbsp; Belowis a snippet of code where I was using EntityAspect.EntityManager for aNullEntity, and the changes I made to deal with the new behavior in 6.1.3.1.<o:p></o:p></p><p ="Ms&#111;normal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:  normal;mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:  9.5pt;font-family:C&#111;nsolas;color:blue">public</span><span style="font-size:  9.5pt;font-family:C&#111;nsolas"> <span style="color:#2B91AF">Contact</span> Contact<br></span><span ="Apple-style-span" style="font-family: C&#111;nsolas; font-size: 13px; ">{<br></span><span ="Apple-style-span" style="color: rgb0, 0, 255; font-family: C&#111;nsolas; font-size: 13px; ">&nbsp; &nbsp;</span><span ="Apple-style-span" style="font-family: C&#111;nsolas; font-size: 13px; "><font ="Apple-style-span" color="#0000ff">get<br></font></span><span ="Apple-style-span" style="font-family: C&#111;nsolas; font-size: 13px; ">&nbsp; &nbsp;</span><span ="Apple-style-span" style="font-family: C&#111;nsolas; font-size: 13px; ">{<br></span><span ="Apple-style-span" style="font-family: C&#111;nsolas; font-size: 13px; ">&nbsp; &nbsp;</span><span ="Apple-style-span" style="font-family: C&#111;nsolas; font-size: 13px; ">&nbsp;&nbsp;&nbsp;</span><span style="font-family: C&#111;nsolas; font-size: 13px; color: blue; ">if</span><span ="Apple-style-span" style="font-family: C&#111;nsolas; font-size: 13px; "> (</span><span style="font-family: C&#111;nsolas; font-size: 13px; color: blue; ">this</span><span ="Apple-style-span" style="font-family: C&#111;nsolas; font-size: 13px; ">.EntityAspect.IsNullEntity)<br></span><span ="Apple-style-span" style="font-family: C&#111;nsolas; font-size: 13px; ">&nbsp; &nbsp; &nbsp;&nbsp;</span><span ="Apple-style-span" style="font-family: C&#111;nsolas; font-size: 13px; ">{<br></span><span ="Apple-style-span" style="font-family: C&#111;nsolas; font-size: 13px; ">&nbsp; &nbsp; &nbsp;&nbsp;</span><span ="Apple-style-span" style="font-family: C&#111;nsolas; font-size: 13px; ">&nbsp;&nbsp;&nbsp;</span><span style="font-family: C&#111;nsolas; font-size: 13px; "><font ="Apple-style-span" color="#008000">// 6.1.3.1 returnthis.EntityAspect.EntityManager.GetNullEntity&lt;Contact&gt;();<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//&nbsp;</font></span><span ="Apple-style-span" style="color: rgb0, 128, 0; font-family: C&#111;nsolas; font-size: 13px; ">this.EntityAspect.EntityManager is now null here.</span><span style="font-family: C&#111;nsolas; font-size: 13px; "><font ="Apple-style-span" color="#008000"><br></font></span><span ="Apple-style-span" style="font-family: C&#111;nsolas; font-size: 13px; "><font ="Apple-style-span" color="#008000"></font>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="font-family: C&#111;nsolas; font-size: 13px; color: blue; ">return</span><span ="Apple-style-span" style="font-family: C&#111;nsolas; font-size: 13px; "> </span><span style="font-family: C&#111;nsolas; font-size: 13px; color: rgb43, 145, 175; ">myEntityManager</span><span ="Apple-style-span" style="font-family: C&#111;nsolas; font-size: 13px; ">.MyDefaultManager.GetNullEntity&lt;</span><span style="font-family: C&#111;nsolas; font-size: 13px; color: rgb43, 145, 175; ">Contact</span><span ="Apple-style-span" style="font-family: C&#111;nsolas; font-size: 13px; ">&gt;(); </span><span style="font-family: C&#111;nsolas; font-size: 13px; "><font ="Apple-style-span" color="#008000">//6.1.3.1<br></font></span><span ="Apple-style-span" style="font-family: C&#111;nsolas; font-size: 13px; ">&nbsp; &nbsp; &nbsp; &nbsp;</span><span ="Apple-style-span" style="font-family: C&#111;nsolas; font-size: 13px; ">}<br></span><span ="Apple-style-span" style="font-family: C&#111;nsolas; font-size: 13px; ">&nbsp; &nbsp; &nbsp; &nbsp;</span><span style="font-family: C&#111;nsolas; font-size: 13px; "><font ="Apple-style-span" color="#008000">// Otherwise, get and return a Contact using custom logic…<br></font></span><span ="Apple-style-span" style="font-family: C&#111;nsolas; font-size: 13px; ">&nbsp;&nbsp;</span><span ="Apple-style-span" style="font-family: C&#111;nsolas; font-size: 13px; ">}<br></span><span ="Apple-style-span" style="font-family: C&#111;nsolas; font-size: 13px; ">}</span></p><p ="Ms&#111;normal"><o:p>&nbsp;</o:p>My questions are: &nbsp;<br>What was the reason for this change?&nbsp;&nbsp;<br>Is there some other recommended way to accomplish what I’m doing withoutresorting to a “default entity manager”?&nbsp;&nbsp;<br>Do you see any likely problems with using this “default” entity manager &nbsp;approach</p><p ="Ms&#111;normal"><o:p></o:p></p><p ="Ms&#111;normal">I’ve also noticed that now an entity becomes Detached after it’s saved.&nbsp; Previously it remained attached to it’s entitymanager and was just set to UnChanged.&nbsp;What was the rationale for this change in behavior?&nbsp; If I just re-attach an entity after saving(as below), what sort of side-effects should I watch out for?<o:p></o:p></p><p ="Ms&#111;normal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:  normal;mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:  9.5pt;font-family:C&#111;nsolas">_entityManager.SaveChanges(<span style="color:blue">new</span><span style="color:#2B91AF">EntityBase</span>&#091;&#093; { entity });<br></span><span ="Apple-style-span" style="font-family: C&#111;nsolas; font-size: 13px; ">_entityManager.AttachEntity(entity); </span><span style="font-family: C&#111;nsolas; font-size: 13px; color: green; ">// fix for version 6.1.3.1</span></p><p ="Ms&#111;normal"><o:p><br></o:p></p><p ="Ms&#111;normal"><o:p>&nbsp;</o:p>Thanks!</p><p ="Ms&#111;normal"><br></p>]]>
   </description>
   <pubDate>Tue, 06 Dec 2011 15:00:38 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3128&amp;PID=12170#12170</guid>
  </item> 
 </channel>
</rss>