<?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 : NullEntity of derived entities of an abstract entity</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : NullEntity of derived entities of an abstract entity</description>
  <pubDate>Mon, 13 Apr 2026 05:54:42 -700</pubDate>
  <lastBuildDate>Tue, 17 Jan 2012 19:33:29 -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=3214</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>NullEntity of derived entities of an abstract entity :  Hi Frederic,This does sound...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3214&amp;PID=12478#12478</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> 3214<br /><strong>Posted:</strong> 17-Jan-2012 at 7:33pm<br /><br />Hi Frederic,<div><br></div><div>This does sound like a bug. However, I'm having difficulty reproducing it here. Attached is my repro solution. Could you help add/modify the test to make it fail? I believe my model structure is the same as yours.</div><div><br></div><div>If it's different, you can just send your edmx to me and I'll do my repro with your model. You can use the customer support form,&nbsp;<a href="http://www.ideablade.com/technical-support/CustomerSupportRequest&#070;orm.aspx" target="_blank">http://www.ideablade.com/technical-support/CustomerSupportRequestForm.aspx</a>, to send the edmx and refer to this forum post.</div><div><br></div><div><a href="uploads/912/C&#111;nsole_T11402.zip" target="_blank">uploads/912/Console_T11402.zip</a></div><span style="font-size:10px"><br /><br />Edited by DenisK - 17-Jan-2012 at 7:37pm</span>]]>
   </description>
   <pubDate>Tue, 17 Jan 2012 19:33:29 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3214&amp;PID=12478#12478</guid>
  </item> 
  <item>
   <title>NullEntity of derived entities of an abstract entity : Good morning gents,As you may...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3214&amp;PID=12463#12463</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1263" rel="nofollow">Frederic</a><br /><strong>Subject:</strong> 3214<br /><strong>Posted:</strong> 13-Jan-2012 at 8:11am<br /><br />Good morning gents,<div><br></div><div>As you may be aware, we are undergoing a migration of a rather large application from&nbsp;<span style="font-family: Calibri, sans-serif; font-size: 11pt; ">EntityFramework toDevForce.</span></div><div><span style="font-family: Calibri, sans-serif; font-size: 11pt; ">This week we have experienced a new problem regarding the&nbsp;</span><span style="font-family: Calibri, sans-serif; font-size: 11pt; ">NULLO (Null Entity)for an abstract class.</span></div><div><span style="font-family: Calibri, sans-serif; font-size: 11pt; "><br></span></div><div><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;  mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-:  EN-US;mso-fareast-:EN-US;mso-bidi-:AR-SA">Let’s consider thefollowing classes declaration (one base and two derived):</span></div><div><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;  mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-:  EN-US;mso-fareast-:EN-US;mso-bidi-:AR-SA"><br></span></div><div style="text-align: -webkit-auto;"><span style=": rgb251, 251, 253; text-align: left; "><table width="99%"><tr><td><pre class="BBcode"></span><span style=": rgb251, 251, 253; text-align: left; "><font color=BLUE></span><span style="text-align: left; : rgb251, 251, 253; ">public abstract class</span><span style=": rgb251, 251, 253; text-align: left; "></font>&nbsp;</span><font color=MEDIUMTURQUOISE><span style=": rgb251, 251, 253; text-align: left; ">Color</span><span style=": rgb251, 251, 253; text-align: left; "></font>&nbsp;: IbEm.</span><font color=MEDIUMTURQUOISE><span style=": rgb251, 251, 253; text-align: left; ">Entity</span></font></div><div><span style="text-align: left; : rgb251, 251, 253; "><div>{</div><div>&nbsp; &nbsp;&nbsp;<font color=GREY>/// &lt;summary&gt;Gets or sets the ID. &lt;/summary&gt;</font></div><div><div>&nbsp; &nbsp; &#091;<font color=MEDIUMTURQUOISE>Key</font>&#093;</div><div>&nbsp; &nbsp; &#091;<font color=MEDIUMTURQUOISE>DataMember</font>&#093;</div><div>&nbsp; &nbsp; &#091;<font color=MEDIUMTURQUOISE>Bindable</font>(<font color=BLUE>true</font>, BindingDirection.TwoWay)&#093;</div><div>&nbsp; &nbsp; &#091;<font color=MEDIUMTURQUOISE>Editable</font>(<font color=BLUE>true</font>)&#093;</div><div>&nbsp; &nbsp; &#091;<font color=MEDIUMTURQUOISE>Display</font>(Name=<font color=SADDLEBROWN>"ID"</font>, AutoGenerateField=<font color=BLUE>true</font>)&#093;</div><div>&nbsp; &nbsp; &#091;IbVal.<font color=MEDIUMTURQUOISE>RequiredValueVerifier</font>( ErrorMessageResourceName=<font color=SADDLEBROWN>"PEQ_LNContainer_ID"</font>)&#093;</div><div>&nbsp; &nbsp; <font color=BLUE>public</font> System.<font color=MEDIUMTURQUOISE>Guid</font> ID {</div><div>&nbsp; &nbsp; &nbsp; <font color=BLUE>get</font> { <font color=BLUE>return</font> <font color=MEDIUMTURQUOISE>PropertyMetadata</font>.ID.GetValue(<font color=BLUE>this</font>); }</div><div>&nbsp; &nbsp; &nbsp;&nbsp;<font color=BLUE>set</font> { <font color=MEDIUMTURQUOISE>PropertyMetadata</font>.ID.SetValue(<font color=BLUE>this</font>, <font color=BLUE>value</font>); }</div><div>&nbsp; &nbsp; }</div>}</div><div><br></div><div><div><font color=BLUE>public class</font> <font color=MEDIUMTURQUOISE>Red</font> : <font color=MEDIUMTURQUOISE>Color</font> {}</div><div><font color=BLUE>public class</font> <font color=MEDIUMTURQUOISE>Blue</font> : <font color=MEDIUMTURQUOISE>Color</font> {}</div></div><div><br></div><div><font color=BLUE>public class</font> <font color=MEDIUMTURQUOISE>Car</font>&nbsp;</div><div>{</div><div>&nbsp; &nbsp; <font color=GREEN>// Data Properties</font></div><div>&nbsp; &nbsp; <font color=BLUE>public</font> System.<font color=MEDIUMTURQUOISE>Nullable</font>&lt;System.<font color=MEDIUMTURQUOISE>Guid</font>&gt; ColorID;</div><div><br></div><div>&nbsp; &nbsp; <font color=GREEN>// Navigation Properties</font></div><div>&nbsp; &nbsp; <font color=BLUE>public</font> <font color=MEDIUMTURQUOISE>Color</font> Color { <font color=BLUE>get</font> {...}; <font color=BLUE>set</font> {...}; }</div><br></span><span style=": rgb251, 251, 253; text-align: left; ">}</span><span style="text-align: left; : rgb251, 251, 253; "></pre></td></tr></table></span></div><div style="text-align: left;"><br></div><div style="text-align: left;">Before getting to the painting chamber, a car does not have any color. Let’s consider the following test code:</div><div style="text-align: left;"><br></div><div style="text-align: left;"><table width="99%"><tr><td><pre class="BBcode"><font color=MEDIUMTURQUOISE>Car</font> aCar = <font color=BLUE>new</font> <font color=MEDIUMTURQUOISE>Car</font>() {Color = <font color=BLUE>null</font>};</div><div style="text-align: left;">Assert.IsTrue(aCar.Color == null);</div><div style="text-align: left;">Assert.IsFalse(aCar.Color <font color=BLUE>is</font> <font color=MEDIUMTURQUOISE>Red</font>);</div><div style="text-align: left;">Assert.IsFalse(aCar.Color <font color=BLUE>is</font> <font color=MEDIUMTURQUOISE>Blue</font>);</div><div style="text-align: left;">Assert.IsTrue((aCar.Color <font color=BLUE>as</font> <font color=MEDIUMTURQUOISE>Red</font>) == <font color=BLUE>null</font>);</div><div style="text-align: left;">Assert.IsTrue((aCar.Color <font color=BLUE>as</font> <font color=MEDIUMTURQUOISE>Blue</font>) == <font color=BLUE>null</font>);</pre></td></tr></table></div><div style="text-align: left;"><div><br></div><div>With EntityFramework:</div><div><ul><li>All tests are passing successfully.</li></ul></div><div><br></div><div>With DevForce</div><div><ul><li>The comparison to null is successful because we implemented an override for the “==” operator to consider the EntityAspect.IsNullEntity.</li><li>BUT the <font color=BLUE>is</font> and <font color=BLUE>as</font> keywords tests are sometimes passing, something not, depending on what NULLO instance was created during instanciation.</li></ul></div><div><br></div><div>As no color were assigned to the car yet, all casts of the Color property (either to red or blue) should still return null as it is the case with EntityFramework.</div><div><br></div><div>My guess is that DevForce is instanciating NULLO of the abstract class by choosing one of the NULLO in the list of concrete classes and that, sometime it is choosing the NULLO of the Red type and sometime it is choosing the NULLO of the Blue type. This creates all sort of side effect in the production code.</div><div><br></div><div>Any idea on how to overcome this (other than testing the nullabilitty of the properties or rewritting all the production code and tests)?</div><div><br></div><div>Hope you follow</div></div>]]>
   </description>
   <pubDate>Fri, 13 Jan 2012 08:11:02 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3214&amp;PID=12463#12463</guid>
  </item> 
 </channel>
</rss>