<?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 : Unexpected loading from the database</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Unexpected loading from the database</description>
  <pubDate>Sun, 12 Apr 2026 02:48:09 -700</pubDate>
  <lastBuildDate>Mon, 24 Jan 2011 11:19:26 -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=2453</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>Unexpected loading from the database : Hi tj62,   This is a consequence...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2453&amp;PID=9764#9764</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=892" rel="nofollow">sbelini</a><br /><strong>Subject:</strong> 2453<br /><strong>Posted:</strong> 24-Jan-2011 at 11:19am<br /><br />Hi tj62, <DIV>&nbsp;</DIV><DIV>This is a consequence of query inversion. (From wiki: "<EM>Query inversion is the process of retrieving those non-targeted objects that are nonetheless necessary for correct completion of a query</EM>")</DIV><DIV>&nbsp;</DIV><DIV>The reason for that is is so that the query can be applied against a pool of data that combines unpersisted local data with data that exists in the datasource.</DIV><DIV>&nbsp;</DIV><DIV>If you want to avoid this behavior, you should query the DataSourceOnly. (setting QueryInversionMode to Off will also&nbsp;set the QueryStrategy to DataSource only)</DIV><DIV>&nbsp;</DIV><DIV>You can find more info about QueryInversion in our <a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/EntityCaching_QueryStrategy" target="_blank">DevForce Resource Center</A>.</DIV><DIV>&nbsp;</DIV><DIV>Silvio.</DIV>]]>
   </description>
   <pubDate>Mon, 24 Jan 2011 11:19:26 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2453&amp;PID=9764#9764</guid>
  </item> 
  <item>
   <title>Unexpected loading from the database : Hi,I have a query like this:...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2453&amp;PID=9724#9724</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=508" rel="nofollow">tj62</a><br /><strong>Subject:</strong> 2453<br /><strong>Posted:</strong> 20-Jan-2011 at 4:31am<br /><br />Hi,<div>I have a query like this:</div><p ="Ms&#111;normal" style="margin-bottom:0cm;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;mso-bidi-font-family:C&#111;nsolas"><span style="mso-spacerun:yes">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color:blue">var</span>query = p_manager.EntItemSet.Include(<span style="color:#A31515">"p_icon"</span>)<o:p></o:p></span></p><p ="Ms&#111;normal" style="margin-bottom:0cm;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;mso-bidi-font-family:C&#111;nsolas"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>.OrderBy(p =&gt;p.p_friendlyName)<o:p></o:p></span></p><p ="Ms&#111;normal" style="margin-bottom:0cm;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;mso-bidi-font-family:C&#111;nsolas"><span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>.Where(p =&gt;p.p_customerID == parent.p_customerID &amp;&amp;<o:p></o:p></span></p><p ="Ms&#111;normal" style="margin-bottom:0cm;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;mso-bidi-font-family:C&#111;nsolas"><span style="mso-spacerun:yes">&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>p.p_pointID== parent.p_pointID &amp;&amp;<o:p></o:p></span></p><p ="Ms&#111;normal" style="margin-bottom:0cm;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;mso-bidi-font-family:C&#111;nsolas"><span style="mso-spacerun:yes">&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>p.p_groupID== parent.p_groupID &amp;&amp;<o:p></o:p></span></p><div><span ="Apple-style-span" style="font-family: C&#111;nsolas; line-height: normal; font-size: 13px; "><span style="mso-spacerun:yes">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span>p.p_deviceItem.p_visible &gt; 0);</span></div><div><br></div><div><span ="Apple-style-span" style="font-family: C&#111;nsolas; line-height: normal; font-size: 13px; "></span>What I have noticed is that&nbsp;because&nbsp;of the last where criteria "<span ="Apple-style-span" style="font-family: C&#111;nsolas; line-height: normal; font-size: 13px; ">p.p_deviceItem.p_visible &gt; 0</span>" , the Entity items for "<span ="Apple-style-span" style="font-family: C&#111;nsolas; line-height: normal; font-size: 13px; ">p.p_deviceItem</span>" are loaded too from the database and put into the Entity Cash on the client.<br>It looks like this last where criteria is performed in the Entity Model but not in the Database Engine that would of course be faster and eliminate loading the p_deviceItem Entities from the database.<br>Why is this such? Can this be avoided?</div>]]>
   </description>
   <pubDate>Thu, 20 Jan 2011 04:31:33 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2453&amp;PID=9724#9724</guid>
  </item> 
 </channel>
</rss>