<?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 : Null Entities in a Managed List</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce Classic : Null Entities in a Managed List</description>
  <pubDate>Tue, 28 Apr 2026 05:52:16 -700</pubDate>
  <lastBuildDate>Wed, 15 Aug 2007 14:20:57 -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=368</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>Null Entities in a Managed List : Makes sense - thanks for clearing...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=368&amp;PID=929#929</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=110" rel="nofollow">sieepvvalk</a><br /><strong>Subject:</strong> 368<br /><strong>Posted:</strong> 15-Aug-2007 at 2:20pm<br /><br />Makes sense - thanks for clearing that up! I appreciate all your help David!<DIV>&nbsp;</DIV><DIV>Todd</DIV>]]>
   </description>
   <pubDate>Wed, 15 Aug 2007 14:20:57 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=368&amp;PID=929#929</guid>
  </item> 
  <item>
   <title>Null Entities in a Managed List : There is a one time scan that...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=368&amp;PID=928#928</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> 368<br /><strong>Posted:</strong> 15-Aug-2007 at 2:18pm<br /><br />There is a one time scan that happens when the EntityListManager is created.&nbsp; If that scan finds a NullEntity, the NullEntity is discarded.&nbsp; However, you can add a NullEntity at any later point, and as long as the filter doesn't discard the NullEntity, it will stick.<DIV>&nbsp;</DIV><DIV>The underlying reason for discarding the NullEntity is that anything in an EntityList should also exist in the Persistence cache.&nbsp; The NullEntity is a detached entity and, as such, is not considered to exist in the cache or anywhere else.</DIV>]]>
   </description>
   <pubDate>Wed, 15 Aug 2007 14:18:25 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=368&amp;PID=928#928</guid>
  </item> 
  <item>
   <title>Null Entities in a Managed List : I see - thanks for looking into...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=368&amp;PID=925#925</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=110" rel="nofollow">sieepvvalk</a><br /><strong>Subject:</strong> 368<br /><strong>Posted:</strong> 15-Aug-2007 at 8:15am<br /><br />I see - thanks for looking into it - I appreciate your help!<DIV>&nbsp;</DIV><DIV>In the same regard - will the list maintain the null entity when it gets updated?&nbsp; Say a record is added to the list - will the null entity stay around, or will it disappear?&nbsp; Can you explain the underlying logic as to why the null entity is removed when we attach the list manager after adding it - I want to make sure that I don't run into this problem again in the future.</DIV><DIV>&nbsp;</DIV><DIV>Thanks,</DIV><DIV>Todd</DIV>]]>
   </description>
   <pubDate>Wed, 15 Aug 2007 08:15:03 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=368&amp;PID=925#925</guid>
  </item> 
  <item>
   <title>Null Entities in a Managed List : Actually, we were both right. You...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=368&amp;PID=922#922</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> 368<br /><strong>Posted:</strong> 14-Aug-2007 at 4:53pm<br /><br /><P>Actually, we were both right.</P><P>You are correct that if you create an EntityListManager with a NullEntity, then the NullEntity will be automatically removed even if the filter always evaluates to true.</P><DIV>My example is also correct in that you must create a filter which accepts the NullEntity.&nbsp; However, the secret of my example working is that I add the NullEntity after the EntityListManager is created.&nbsp; I tried this with your code, and now your NullEntity is no longer removed:</DIV><DIV>&nbsp;</DIV><DIV><P =Ms&#111;normal style="MARGIN: 0in 0in 0pt"><FONT size=3><FONT face="Times New Roman"><SPAN style="COLOR: blue; mso-no-proof: yes">public</SPAN><SPAN style="mso-no-proof: yes"> <SPAN style="COLOR: blue">static</SPAN> <SPAN style="COLOR: #2b91af">EntityList</SPAN>&lt;T&gt; RetrieveWithNull&lt;T&gt;(<SPAN style="COLOR: #2b91af">PersistenceManager</SPAN> pManager) <SPAN style="COLOR: blue">where</SPAN> T : <SPAN style="COLOR: #2b91af">Entity</SPAN> {<?:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></FONT></FONT></P><P =Ms&#111;normal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">EntityList</SPAN>&lt;T&gt; entityList = pManager.GetEntities&lt;T&gt;();<o:p></o:p></FONT></FONT></SPAN></P><P =Ms&#111;normal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>entityList.ApplySort(<SPAN style="COLOR: #a31515">"LastName"</SPAN>, System.ComponentModel.<SPAN style="COLOR: #2b91af">ListSortDirection</SPAN>.Ascending, <SPAN style="COLOR: blue">true</SPAN>);<o:p></o:p></FONT></FONT></SPAN></P><P =Ms&#111;normal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>entityList.ListManager = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">EntityListManager</SPAN>&lt;T&gt;(pManager, <SPAN style="COLOR: blue">delegate</SPAN>(T pEntity) { <SPAN style="COLOR: blue">return</SPAN> <SPAN style="COLOR: blue">true</SPAN>; }, <SPAN style="COLOR: blue">null</SPAN>, entityList, <SPAN style="COLOR: blue">true</SPAN>);<o:p></o:p></FONT></FONT></SPAN></P><P =Ms&#111;normal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>entityList.Add(pManager.GetNullEntity&lt;T&gt;());<o:p></o:p></FONT></FONT></SPAN></P><P =Ms&#111;normal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">return</SPAN> entityList;<o:p></o:p></FONT></FONT></SPAN></P><P =Ms&#111;normal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></FONT></FONT></SPAN></P></DIV>]]>
   </description>
   <pubDate>Tue, 14 Aug 2007 16:53:23 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=368&amp;PID=922#922</guid>
  </item> 
  <item>
   <title>Null Entities in a Managed List : Hi David,  Thanks for the reply....</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=368&amp;PID=915#915</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=110" rel="nofollow">sieepvvalk</a><br /><strong>Subject:</strong> 368<br /><strong>Posted:</strong> 13-Aug-2007 at 5:13pm<br /><br />Hi David,<DIV>&nbsp;</DIV><DIV>Thanks for the reply.&nbsp; My experience does not match up.&nbsp; I have a generic procedure which gets the class I request, sorts, and then attaches a generic list manager to the class.&nbsp; The code is as follows:</DIV><DIV>&nbsp;</DIV><FONT size=2></FONT><FONT color=#0000ff size=2><FONT size=2><P></FONT><FONT color=#0000ff size=2>public</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>static</FONT><FONT size=2> </FONT><FONT color=#2b91af size=2>EntityList</FONT><FONT size=2>&lt;T&gt; RetrieveWithNull&lt;T&gt;(</FONT><FONT color=#2b91af size=2>PersistenceManager</FONT><FONT size=2> pManager) </FONT><FONT color=#0000ff size=2>where</FONT><FONT size=2> T : </FONT><FONT color=#2b91af size=2>Entity</P></FONT><FONT size=2><P>{</P><P></FONT><FONT color=#2b91af size=2>EntityList</FONT><FONT size=2>&lt;T&gt; entityList = </FONT><FONT size=2>pManager.GetEntities&lt;T&gt;(pManager);</P><P>entityList.Add(pManager</FONT><FONT size=2>.GetNullEntity&lt;T&gt;());</P><P>entityList.ApplySort(</FONT><FONT color=#800000 size=2>"FullName"</FONT><FONT size=2>, System.ComponentModel.</FONT><FONT color=#2b91af size=2>ListSortDirection</FONT><FONT size=2>.Ascending, </FONT><FONT color=#0000ff size=2>true</FONT><FONT size=2>);</P><P>entityList.ListManager = </FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2> </FONT><FONT color=#2b91af size=2>EntityListManager</FONT><FONT size=2>&lt;T&gt;(pManager, </FONT><FONT color=#0000ff size=2>delegate</FONT><FONT size=2>(T pEntity) { </FONT><FONT color=#0000ff size=2>return</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>true</FONT><FONT size=2>; }, </FONT><FONT color=#0000ff size=2>null</FONT><FONT size=2>, entityList, </FONT><FONT color=#0000ff size=2>true</FONT><FONT size=2>);</P><DIV></FONT><FONT color=#0000ff size=2>return</FONT><FONT size=2> entityList;</DIV><P>}</P><DIV></DIV><P>&nbsp;</P><P>because the filter criteria always returns true, the null item should remain in the list...but it doesn't!&nbsp; I'm still&nbsp;confused as to why this might occur...</P><DIV></DIV><DIV></DIV>Thanks,<DIV></DIV>Todd</FONT></FONT>]]>
   </description>
   <pubDate>Mon, 13 Aug 2007 17:13:41 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=368&amp;PID=915#915</guid>
  </item> 
  <item>
   <title>Null Entities in a Managed List : Todd,  It is not true that the...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=368&amp;PID=914#914</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> 368<br /><strong>Posted:</strong> 13-Aug-2007 at 4:42pm<br /><br />Todd,<DIV>&nbsp;</DIV><DIV>It is not true that the Null Entity will automatically be removed from any list owned by a ListManager.&nbsp; It depends on the filter rule.</DIV><DIV>&nbsp;</DIV><DIV>As an experiment, I tried the solution on EntityListManager in the Intermediate Tutorials under BindableList.&nbsp; I saw that the NullEntity was added to the EntityList and I also saw that that this NullEntity was removed from the List.However, I then looked at the filter rule:</DIV><DIV><FONT color=#2b91af size=2></FONT>&nbsp;</DIV><FONT size=2><P></FONT><FONT color=#2b91af size=2>Boolean</FONT><FONT size=2> FilterOrdersByDate(</FONT><FONT color=#2b91af size=2>Order</FONT><FONT size=2> pOrder) {</P><P></FONT><FONT color=#2b91af size=2>Customer</FONT><FONT size=2> currentCustomer = (</FONT><FONT color=#2b91af size=2>Customer</FONT><FONT size=2>)mCustomersBS.Current;</P><P></FONT><FONT color=#0000ff size=2>return</FONT><FONT size=2> (pOrder.OrderDate.Value.Year == 1996 &amp;&amp; pOrder.Customer == currentCustomer</P><P>}</P><DIV></DIV><DIV>The NulEntity was being filtered out because the NullEntity did not have an OrderDate of 1996.</DIV><DIV>&nbsp;</DIV><DIV>I then changed the filter to allow the NullEntity.</DIV><DIV>&nbsp;</DIV><FONT size=2><P></FONT><FONT color=#2b91af size=2>Boolean</FONT><FONT size=2> FilterOrdersByDate(</FONT><FONT color=#2b91af size=2>Order</FONT><FONT size=2> pOrder) {</P><P></FONT><FONT color=#2b91af size=2>Customer</FONT><FONT size=2> currentCustomer = (</FONT><FONT color=#2b91af size=2>Customer</FONT><FONT size=2>)mCustomersBS.Current;</P><P></FONT><FONT color=#0000ff size=2>return</FONT><FONT size=2> (pOrder.OrderDate.Value.Year == 1996 &amp;&amp; pOrder.Customer == currentCustomer</P><P>|| (pOrder.IsNullEntity));</P><P>}</P><DIV></DIV><DIV>Now the NullEntity is no longer being filtered out.</DIV><DIV></FONT></FONT>&nbsp;</DIV>]]>
   </description>
   <pubDate>Mon, 13 Aug 2007 16:42:03 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=368&amp;PID=914#914</guid>
  </item> 
  <item>
   <title>Null Entities in a Managed List : Hello,When creating an entitylist,...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=368&amp;PID=913#913</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=110" rel="nofollow">sieepvvalk</a><br /><strong>Subject:</strong> 368<br /><strong>Posted:</strong> 13-Aug-2007 at 3:37pm<br /><br /><FONT face="Arial, Helvetica, sans-serif" size=2>Hello,<BR><BR>When creating an entitylist, one can add a null entity by calling:<BR><BR>EntityList&lt;Person&gt; personList = pManager.GetEntities&lt;Person&gt;();<BR>personList.Add(pManager.GetNullEntity&lt;Person&gt;());<BR><BR>personList<BR>---------------<BR>John<BR>Sue<BR>Bob<BR>(none)<BR><BR>however, if I attach a list manager to this entitylist, then the null entity <BR>seems to get automatically removed:<DIV><BR>EntityList&lt;Person&gt; personList = pManager.GetEntities&lt;Person&gt;();<BR>personList.Add(pManager.GetNullEntity&lt;Person&gt;());<BR>personList.ListManager = new EntityListManager&lt;Person&gt;(...);<BR><BR>personList<BR>---------------<BR>John <BR>Sue<BR>Bob<BR><BR>Is there a way to ensure that the null entity is not automatically removed <BR>from the list when working with a managed list?<BR><BR>Thank you,<BR><BR>Todd<BR></DIV></FONT>]]>
   </description>
   <pubDate>Mon, 13 Aug 2007 15:37:10 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=368&amp;PID=913#913</guid>
  </item> 
 </channel>
</rss>