<?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 : The other Include()</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : The other Include()</description>
  <pubDate>Tue, 14 Apr 2026 07:26:06 -700</pubDate>
  <lastBuildDate>Thu, 26 Aug 2010 15:59:21 -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=2097</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>The other Include() : Perfect! Nice tip/trick. Thanks ...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2097&amp;PID=8229#8229</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=704" rel="nofollow">mikewishart</a><br /><strong>Subject:</strong> 2097<br /><strong>Posted:</strong> 26-Aug-2010 at 3:59pm<br /><br />Perfect!&nbsp; Nice tip/trick.&nbsp; <br>Thanks]]>
   </description>
   <pubDate>Thu, 26 Aug 2010 15:59:21 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2097&amp;PID=8229#8229</guid>
  </item> 
  <item>
   <title>The other Include() : While the Entity Framework only...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2097&amp;PID=8226#8226</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> 2097<br /><strong>Posted:</strong> 26-Aug-2010 at 3:07pm<br /><br /><DIV>While the Entity Framework only allows you to use Include(String), DevForce goes a step further and allows you to also use simple lambda expressions (i.e. Include(c =&gt; c.Orders) - as in your example).</DIV><DIV>&nbsp;</DIV><DIV>However, you can't use more complex lambda expressions. Our extension to the Include syntax (Include&lt;TQuery&gt;(TQuery,String)) is only an translation wrapper, that allow simple lambda’s to be translated into the Entity Framework’s string based Include syntax (Include(String)). Therefore, we can only support what EF’s Include(String) does.</DIV><DIV>&nbsp;</DIV><DIV>You can still accomplish the functionality you want by using an anonymous type: </DIV><DIV>&nbsp;</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mgr.Customers.Where(c =&gt; c.CustomerID == id)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .Select(c =&gt; new { Customer = c, Orders = c.Orders.Where(o =&gt; o.EmployeeID == 5) })<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .ToList() // this is necessary so the query is executed on the server and the related objects are retrieved and stored<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // at this point all objects satisfying the query (Customer and Orders) are&nbsp;in the cache<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .Select(a =&gt; a.Customer); // this is executed locally (data already in the cache)</DIV><DIV>&nbsp;</DIV><DIV>The above will ensure that the objects related&nbsp; (Orders where &#091;EmployeeID&#093; == 5) to the primary target of this query (Customer where &#091;CustomerID&#093; == id) are also stored in the entity cache.<BR></DIV>]]>
   </description>
   <pubDate>Thu, 26 Aug 2010 15:07:40 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2097&amp;PID=8226#8226</guid>
  </item> 
  <item>
   <title>The other Include() : It seems everyone always uses...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2097&amp;PID=8208#8208</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=704" rel="nofollow">mikewishart</a><br /><strong>Subject:</strong> 2097<br /><strong>Posted:</strong> 26-Aug-2010 at 9:15am<br /><br />It seems everyone always uses the Include(string)<br><br>There's the other Include(func):<br>&nbsp;&nbsp;&nbsp; public static IEntityQuery&lt;T&gt; Include&lt;T&gt;(this IEntityQuery&lt;T&gt; query, Expression&lt;Func&lt;T, object&gt;&gt; expr);<br><br>I can't find any examples of using this version.&nbsp; I tried doing mgr.Customers.Include(c =&gt; c.Orders) and this works; however, is it possible to do something more complicated with a where clause?&nbsp; <br>&nbsp;&nbsp; mgr.Customers.Where(c =&gt; c.CustomerID == id)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .Include(c =&gt; c.Orders.Where(o =&gt; o.EmployeeId == 5))<br><br>If not it seems the alternative is to use a parallel task or to get all the orders and remove those that we're not interested in from the cache after the result comes back.<br><br>Thanks!<br>]]>
   </description>
   <pubDate>Thu, 26 Aug 2010 09:15:46 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2097&amp;PID=8208#8208</guid>
  </item> 
 </channel>
</rss>