<?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 : Navigation Properties slowing down query</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Navigation Properties slowing down query</description>
  <pubDate>Mon, 13 Apr 2026 20:39:29 -700</pubDate>
  <lastBuildDate>Fri, 03 Jun 2011 00:42:07 -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=2740</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>Navigation Properties slowing down query :   Are you developing in WPF...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2740&amp;PID=10888#10888</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=877" rel="nofollow">pompomJuice</a><br /><strong>Subject:</strong> 2740<br /><strong>Posted:</strong> 03-Jun-2011 at 12:42am<br /><br /><div>Are you developing in WPF or SL?</div><div><br></div>Navigational properties in SL are&nbsp;loaded&nbsp;asynchronously (WPF might be sync?).&nbsp;Therefore, if you pump those query results into a DataGrid<b> </b>with&nbsp;auto generate&nbsp;fields set to true, it would definitely do async fetches on all those nav properties because the DataGrid is touching them. Whatever the case, something in your code is trying to view those nav properties!<div><br></div><div>If this is your scenario then you could speed the process up by Include(ing) the nav properties from the&nbsp;get go, saving you the time those individual async/sync fetches would have taken.<br><div><br></div><div>W</div><div><br></div></div><span style="font-size:10px"><br /><br />Edited by pompomJuice - 03-Jun-2011 at 12:44am</span>]]>
   </description>
   <pubDate>Fri, 03 Jun 2011 00:42:07 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2740&amp;PID=10888#10888</guid>
  </item> 
  <item>
   <title>Navigation Properties slowing down query :   I have this query:var query...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2740&amp;PID=10883#10883</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=579" rel="nofollow">gregweb</a><br /><strong>Subject:</strong> 2740<br /><strong>Posted:</strong> 02-Jun-2011 at 7:10am<br /><br />I have this query:<div><font color="#0000ff" size="2" face="C&#111;nsolas"><font color="#0000ff" size="2" face="C&#111;nsolas"><font color="#0000ff" size="2" face="C&#111;nsolas"></font></font></font>&nbsp;</div><div><font color="#0000ff" size="2" face="C&#111;nsolas"><font color="#0000ff" size="2" face="C&#111;nsolas"><font color="#0000ff" size="2" face="C&#111;nsolas">var</font></font></font><font size="2" face="C&#111;nsolas"><font size="2" face="C&#111;nsolas"> query = </font></font><font color="#0000ff" size="2" face="C&#111;nsolas"><font color="#0000ff" size="2" face="C&#111;nsolas"><font color="#0000ff" size="2" face="C&#111;nsolas">this</font></font></font><font size="2" face="C&#111;nsolas"><font size="2" face="C&#111;nsolas">.EmailEntityManager.EmailFolderEntities</font></font><font size="2" face="C&#111;nsolas"><font size="2" face="C&#111;nsolas">.Where(a =&gt; a.EmailAccountId == </font></font><font color="#0000ff" size="2" face="C&#111;nsolas"><font color="#0000ff" size="2" face="C&#111;nsolas"><font color="#0000ff" size="2" face="C&#111;nsolas">this</font></font></font><font size="2" face="C&#111;nsolas"><font size="2" face="C&#111;nsolas">.CurrentEmailAccount.Id)</font></font><font size="2" face="C&#111;nsolas"><font size="2" face="C&#111;nsolas">.Where(a=&gt; a.Visible == </font></font><font color="#0000ff" size="2" face="C&#111;nsolas"><font color="#0000ff" size="2" face="C&#111;nsolas"><font color="#0000ff" size="2" face="C&#111;nsolas">true</font></font></font><font size="2" face="C&#111;nsolas"><font size="2" face="C&#111;nsolas">)</font></font><font size="2" face="C&#111;nsolas"><font size="2" face="C&#111;nsolas">.Where(a =&gt; a.IsDeleted ==</font></font><font color="#0000ff" size="2" face="C&#111;nsolas"><font color="#0000ff" size="2" face="C&#111;nsolas"><font color="#0000ff" size="2" face="C&#111;nsolas">false</font></font></font><font size="2" face="C&#111;nsolas"><font size="2" face="C&#111;nsolas">)</font></font><font size="2" face="C&#111;nsolas"><font size="2" face="C&#111;nsolas">;</div></font></font><div>&nbsp;</div><div>&nbsp;</div><div>EmailFolderEntities has several navigation properties such as EmailAccount and ChildFolders.&nbsp;&nbsp; When the query executes, these navigation properties are being populated.&nbsp; The issue with that is that it slows down the query dramatically - like from a second or two to 10 seconds.&nbsp; If I delete the navigation properties, then the query speeds up again.</div><div>&nbsp;</div><div>I thought that the navigation properities would not be populated unless there was a specific "Include" statement in the query such as </div><div>&nbsp;</div><div><font size="2"><font face="C&#111;nsolas"><font color="#0000ff">var</font> query = <font color="#0000ff"><font color="#0000ff"><font color="#0000ff">this</font></font></font>.EmailEntityManager.EmailFolderEntities.Where(a =&gt; a.EmailAccountId == <font color="#0000ff"><font color="#0000ff"><font color="#0000ff">this</font></font></font>.CurrentEmailAccount.Id).Where(a=&gt; a.Visible == <font color="#0000ff"><font color="#0000ff"><font color="#0000ff">true</font></font></font>).Where(a =&gt; a.IsDeleted ==<font color="#0000ff"><font color="#0000ff"><font color="#0000ff">false</font></font></font>)</font></font></div><div><font size="2"><font face="C&#111;nsolas">.include("EmailAccount");</font></font></div><div><font size="2" face="C&#111;nsolas"></font>&nbsp;</div><div><font size="2" face="C&#111;nsolas"></font>&nbsp;</div><div><font size="2" face="C&#111;nsolas">Greg</font></div>]]>
   </description>
   <pubDate>Thu, 02 Jun 2011 07:10:18 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2740&amp;PID=10883#10883</guid>
  </item> 
 </channel>
</rss>