<?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 : options.Include of navigation property collections</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : Community Forum : options.Include of navigation property collections</description>
  <pubDate>Thu, 16 Apr 2026 04:33:55 -700</pubDate>
  <lastBuildDate>Wed, 15 May 2013 14:41:22 -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=4150</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>options.Include of navigation property collections : I agree - magic strings are asking...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4150&amp;PID=16345#16345</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=613" rel="nofollow">stephenmcd1</a><br /><strong>Subject:</strong> 4150<br /><strong>Posted:</strong> 15-May-2013 at 2:41pm<br /><br />I agree - magic strings are asking for trouble.<div><br></div><div>I've update the code sample to include the <a href="http://opensource.org/licenses/MIT" target="_blank">MIT license</a> which as far as I know means you can use it in just about any way you'd like. &nbsp;I'm not an expert on licensing so if that doesn't work for you, let me know.</div><div><br></div><div>Glad the code will work for you!</div>]]>
   </description>
   <pubDate>Wed, 15 May 2013 14:41:22 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4150&amp;PID=16345#16345</guid>
  </item> 
  <item>
   <title>options.Include of navigation property collections : Stephen,	Do you have a license...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4150&amp;PID=16344#16344</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1570" rel="nofollow">KitKat</a><br /><strong>Subject:</strong> 4150<br /><strong>Posted:</strong> 15-May-2013 at 1:12pm<br /><br />Stephen,<div><span ="Apple-tab-span" style="white-space:pre">	</span>Do you have a license for the code you linked, or is it public domain and free for me to use?</div><div><br></div><div>Thank you,</div><div>Katerina</div>]]>
   </description>
   <pubDate>Wed, 15 May 2013 13:12:50 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4150&amp;PID=16344#16344</guid>
  </item> 
  <item>
   <title>options.Include of navigation property collections : Thank you all for your responses.Stephan,...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4150&amp;PID=16343#16343</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1570" rel="nofollow">KitKat</a><br /><strong>Subject:</strong> 4150<br /><strong>Posted:</strong> 15-May-2013 at 1:09pm<br /><br />Thank you all for your responses.<div><br></div><div>Stephan, this is exactly what I was looking for. &nbsp;I like to stay as far away from Magic Strings as I can.</div><div><br></div><div>Thank you all again,</div><div>Katerina</div>]]>
   </description>
   <pubDate>Wed, 15 May 2013 13:09:45 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4150&amp;PID=16343#16343</guid>
  </item> 
  <item>
   <title>options.Include of navigation property collections : I&amp;#039;ve built a helper class...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4150&amp;PID=16342#16342</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=613" rel="nofollow">stephenmcd1</a><br /><strong>Subject:</strong> 4150<br /><strong>Posted:</strong> 15-May-2013 at 12:09pm<br /><br />I've built a helper class that builds strings such as '<span style=": rgb251, 251, 253;">Employee.Jobs.LwHrJob' using strongly typed lambdas. &nbsp;It's not always the easiest to use but it gets the job done. &nbsp;And for us, a little bit of annoyance/verbosity when first writing the code is worth it if it saves of from running into problems if the model changes. &nbsp;An example usage of the helper class would be:<table width="99%"><tr><td><pre class="BBcode"></span><span style=": rgb251, 251, 253;"></span><span style=": rgb251, 251, 253;">&nbsp; &nbsp; &#091;TestMethod&#093;</span><span style=": rgb251, 251, 253;"><div>&nbsp; &nbsp; public void TestBuildPath()</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; var actualPath = IncludeHelper</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .BuildPathFor&lt;User&gt;()</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .Include(user =&gt; user.Employee)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .IncludeMany(employee =&gt; employee.Jobs)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .Include(job =&gt; job.Detail)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .ToString();</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; Assert.AreEqual("Employee.Jobs.Detail", actualPath);</div><br></span><span style=": rgb251, 251, 253;">&nbsp; &nbsp; }</span><span style=": rgb251, 251, 253;"></pre></td></tr></table></span><div><span style=": rgb251, 251, 253;"><br></span></div><div><span style=": rgb251, 251, 253;">In this case, the IncludeMany method is the one that is really giving us value because it lets us 'flatten' the collection.</span></div><div><span style=": rgb251, 251, 253;"><br></span></div><div><span style=": rgb251, 251, 253;">You can get the full code from here: &nbsp;</span><a href="http://gist.github.com/stephenmcd1/5586462" target="_blank">https://gist.github.com/stephenmcd1/5586462</a></div>]]>
   </description>
   <pubDate>Wed, 15 May 2013 12:09:16 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4150&amp;PID=16342#16342</guid>
  </item> 
  <item>
   <title>options.Include of navigation property collections : The extension method is a good...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4150&amp;PID=16341#16341</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1005" rel="nofollow">mgood</a><br /><strong>Subject:</strong> 4150<br /><strong>Posted:</strong> 15-May-2013 at 11:05am<br /><br />The extension method is a good idea. Other than that you can't strongly type it because Employee.Jobs.LwHrJob would mean that LwHrJob is a property of the Jobs collection when in fact it is a property of each item in the Jobs collection. You won't get this past the compiler.&nbsp;]]>
   </description>
   <pubDate>Wed, 15 May 2013 11:05:02 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4150&amp;PID=16341#16341</guid>
  </item> 
  <item>
   <title>options.Include of navigation property collections : i wrote an extension method for...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4150&amp;PID=16340#16340</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=449" rel="nofollow">smi-mark</a><br /><strong>Subject:</strong> 4150<br /><strong>Posted:</strong> 15-May-2013 at 9:45am<br /><br />i wrote an extension method for queries, you could do the same for the options<br><br><table width="99%"><tr><td class="BBquote"><br>&nbsp;&nbsp;&nbsp; public static class EntityQueryExtensions<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public static IEntityQuery&lt;T&gt; IncludePath&lt;T&gt;(this IEntityQuery&lt;T&gt; query, params string&#091;&#093; propertyPaths)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return query.Include(propertyPaths.Aggregate((a, b) =&gt; a + "." + b));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br></td></tr></table><br><br><br>something like this:<br><br>.IncludePath(Employee.EntityPropertyNames.Jobs, Job.EntityPropertyNames.LwHrJob)<br><br><br><br>]]>
   </description>
   <pubDate>Wed, 15 May 2013 09:45:17 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4150&amp;PID=16340#16340</guid>
  </item> 
  <item>
   <title>options.Include of navigation property collections : How can you accomplish the strongly...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4150&amp;PID=16336#16336</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1570" rel="nofollow">KitKat</a><br /><strong>Subject:</strong> 4150<br /><strong>Posted:</strong> 15-May-2013 at 7:05am<br /><br />How can you accomplish the strongly typed include when you are navigating past a collection of related entities.<div><br></div><div>In the example below I have had to define one of my includes as a string since Jobs is a RelatedEntityList, and not just a single entity. &nbsp;Is there some function I am missing that would allow me to strongly type this?</div><div><br></div><div>Example:</div><div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var punchUser =</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (await _punchUser</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.FindAsync(e =&gt; e.RecordId == punchId&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&amp;&amp; e.PunchPin == punchPin,&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;null,&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;options =&gt;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;options</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //.Include(user =&gt; user.Employee.Jobs)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .Include("Employee.Jobs.LwHrJob")</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .Include(user =&gt; user.Employee.OrgLevel1)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .Include(user =&gt; user.Employee.OrgLevel2)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .Include(user =&gt; user.Employee.OrgLevel3)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .Include(user =&gt; user.Employee.OrgLevel4)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .Include(user =&gt; user.Employee.OrgLevel5)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; )).FirstOrDefault();</div></div><div><br></div><div>Thank you,</div><div>Kat</div>]]>
   </description>
   <pubDate>Wed, 15 May 2013 07:05:09 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4150&amp;PID=16336#16336</guid>
  </item> 
 </channel>
</rss>