<?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 : Include navigations in a loaded object</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : Community Forum : Include navigations in a loaded object</description>
  <pubDate>Sun, 12 Apr 2026 23:16:47 -700</pubDate>
  <lastBuildDate>Thu, 16 May 2013 05:41:23 -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=4144</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>Include navigations in a loaded object : Ok, I changed my business logic...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4144&amp;PID=16350#16350</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1485" rel="nofollow">cefernan</a><br /><strong>Subject:</strong> 4144<br /><strong>Posted:</strong> 16-May-2013 at 5:41am<br /><br />Ok, I changed my business logic to receive IDs instead of entities.<div><br></div><div>Thank you Marcel.</div>]]>
   </description>
   <pubDate>Thu, 16 May 2013 05:41:23 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4144&amp;PID=16350#16350</guid>
  </item> 
  <item>
   <title>Include navigations in a loaded object : ViewModels and business logic...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4144&amp;PID=16330#16330</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> 4144<br /><strong>Posted:</strong> 14-May-2013 at 6:22pm<br /><br />ViewModels and business logic are best written such that they ensure all the required data is loaded instead of trusting an entity that is passed from the outside. You can help this by passing IDs instead of entities.&nbsp;<div><br></div><div>There are several ways you can accomplish this. The easiest is taking advantage of the query cache in DevForce. If a ViewModel or business logic requests some data and the data has been previously loaded using the same query, the data automatically comes from the cache and it won't&nbsp;round-trip&nbsp;to the server.</div><div><span style="line-height: 1.4;"><br></span></div><div><span style="line-height: 1.4;">&nbsp;</span></div>]]>
   </description>
   <pubDate>Tue, 14 May 2013 18:22:31 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4144&amp;PID=16330#16330</guid>
  </item> 
  <item>
   <title>Include navigations in a loaded object : Let&amp;#039;s go.I have a class allocated...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4144&amp;PID=16319#16319</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1485" rel="nofollow">cefernan</a><br /><strong>Subject:</strong> 4144<br /><strong>Posted:</strong> 13-May-2013 at 5:53am<br /><br />Let's go.<div><br></div><div>I have a class allocated in a different project that receive an object (entity) by parameter and do some business logic. In this code, I need this object and some navigations of this object. If the programmer forget to include the navigations before pass the object to this method, my code will fail. So, to ensure that my code will work, I receive the object and include the navigations in my method.</div><div><br></div><div>To do this I've created this extension method:</div><div><pre style="font-family: C&#111;nsolas; font-size: 13px;"><span style="color: blue;">public</span>&nbsp;<span style="color: blue;">static</span>&nbsp;<span style="color: blue;">async</span>&nbsp;<span style="color: rgb43, 145, 175;">Task</span>&lt;T&gt;&nbsp;GetSingleEntityGraphAsync&lt;T&gt;(<span style="color: blue;">this</span>&nbsp;<span style="color: rgb43, 145, 175;">EntityManager</span>&nbsp;manager,&nbsp;T&nbsp;entity,&nbsp;<span style="color: rgb43, 145, 175;">Action</span>&lt;<span style="color: rgb43, 145, 175;">IFetchOptions</span>&lt;T&gt;&gt;&nbsp;fetchOptions,&nbsp;<span style="color: rgb43, 145, 175;">QueryStrategy</span>&nbsp;strategy&nbsp;=&nbsp;<span style="color: blue;">null</span>)&nbsp;<span style="color: blue;">where</span>&nbsp;T&nbsp;:&nbsp;<span style="color: rgb43, 145, 175;">Entity</span>{&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: rgb43, 145, 175;">IEntityQuery</span>&lt;T&gt;&nbsp;query&nbsp;=&nbsp;entity.ToQuery&lt;T&gt;(); &nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">if</span>&nbsp;(fetchOptions&nbsp;!=&nbsp;<span style="color: blue;">null</span>)&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">var</span>&nbsp;options&nbsp;=&nbsp;<span style="color: blue;">new</span>&nbsp;<span style="color: rgb43, 145, 175;">FetchOptions</span>&lt;T&gt;(query);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fetchOptions(options);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;query&nbsp;=&nbsp;options.Query;&nbsp;&nbsp;&nbsp;&nbsp;}  &nbsp;&nbsp;&nbsp;<span style="color: blue;">if</span>&nbsp;(strategy&nbsp;!=&nbsp;<span style="color: blue;">null</span>)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;query.With(strategy); &nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">var</span>&nbsp;result&nbsp;=&nbsp;<span style="color: blue;">await</span>&nbsp;manager.ExecuteQueryAsync&lt;T&gt;(query);&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">return</span>&nbsp;result.Single();}</pre></div><div><br></div><div>In my business logic:</div><div><pre style="font-family: C&#111;nsolas; font-size: 13px;">...&nbsp;&nbsp;&nbsp;&nbsp;</pre><pre style="font-family: C&#111;nsolas; font-size: 13px;"><span style="color: green;">    //&nbsp;Load&nbsp;necessary&nbsp;data&nbsp;of&nbsp;campaign</span>&nbsp;&nbsp;&nbsp;&nbsp;Campaign&nbsp;=&nbsp;<span style="color: blue;">await</span>&nbsp;EntityManager.GetSingleEntityGraphAsync&lt;<span style="color: rgb43, 145, 175;">Campaign</span>&gt;(Campaign,&nbsp;f&nbsp;=&gt;&nbsp;f&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.Include(i&nbsp;=&gt;&nbsp;i.CampValues).Include(i&nbsp;=&gt;&nbsp;i.CampPrizes));</pre></div><div><pre style="font-family: C&#111;nsolas; font-size: 13px;">...&nbsp;&nbsp;&nbsp;&nbsp;</pre></div><div><br></div><div>But, to create this extension method, I needed to declare my own&nbsp;<span style="font-family: C&#111;nsolas; font-size: 13px; line-height: 1.4; color: rgb43, 145, 175;">FetchOptions</span><span style="font-family: C&#111;nsolas; font-size: 13px; line-height: 1.4;">&lt;T&gt;.</span></div><div><br></div><div>Is it good strategy or do you suggest something better?</div>]]>
   </description>
   <pubDate>Mon, 13 May 2013 05:53:31 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4144&amp;PID=16319#16319</guid>
  </item> 
  <item>
   <title>Include navigations in a loaded object : I think I need some more background...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4144&amp;PID=16315#16315</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> 4144<br /><strong>Posted:</strong> 11-May-2013 at 4:08am<br /><br />I think I need some more background to answer this question.&nbsp;]]>
   </description>
   <pubDate>Sat, 11 May 2013 04:08:23 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4144&amp;PID=16315#16315</guid>
  </item> 
  <item>
   <title>Include navigations in a loaded object : Hi,I have a loaded object (entity)...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4144&amp;PID=16309#16309</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1485" rel="nofollow">cefernan</a><br /><strong>Subject:</strong> 4144<br /><strong>Posted:</strong> 09-May-2013 at 7:35am<br /><br />Hi,<div><br></div><div>I have a loaded object (entity) and now, in another context, I need to include some navigations of this entity.</div><div><br></div><div>How is the best way to do that?</div>]]>
   </description>
   <pubDate>Thu, 09 May 2013 07:35:29 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4144&amp;PID=16309#16309</guid>
  </item> 
 </channel>
</rss>