<?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 : Lazy Loading of Navigation Properties</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Lazy Loading of Navigation Properties</description>
  <pubDate>Mon, 13 Apr 2026 01:16:08 -700</pubDate>
  <lastBuildDate>Tue, 25 Sep 2012 07:09:49 -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=3657</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>Lazy Loading of Navigation Properties : Hah , I couldn&amp;#039;t see the...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3657&amp;PID=14579#14579</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=118" rel="nofollow">LowOrbit</a><br /><strong>Subject:</strong> 3657<br /><strong>Posted:</strong> 25-Sep-2012 at 7:09am<br /><br />Hah , I couldn't see the forest through the trees. That was exactly what I was looking for. I had though about just creating&nbsp;a whole new EntityManager and didn't even think about looking for a simple Clear() command on the EM itself. <DIV>&nbsp;</DIV><DIV><strong>Thanks!!</strong></DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Tue, 25 Sep 2012 07:09:49 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3657&amp;PID=14579#14579</guid>
  </item> 
  <item>
   <title>Lazy Loading of Navigation Properties : The only easy way to do a wholesale...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3657&amp;PID=14572#14572</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> 3657<br /><strong>Posted:</strong> 25-Sep-2012 at 1:37am<br /><br /><P>The only easy way to do a wholesale refresh is to call EntityManager.Clear and then load the data again. Everything else involves complicated sifting through the cache and figuring out what needs to be refreshed along the lines of what your describing. E.g. setting IsLoaded to false etc.</P><DIV>The design pattern that helps you manage this kind of thing is the unit of work pattern. With the unit of work pattern you use multiple EntityManagers each dedicated to a particular task or workflow that the user performs. In your case, the grid would be backed by a unit of work that uses it's own EntityManager. At any point, you can call Clear on the grid's unit of work to refresh the grid without affecting other tasks or workflows in your system. </DIV><DIV>&nbsp;</DIV><DIV>You can learn more about the unit of work pattern at the following link. If you don't use Cocktail it's a good idea to implement the pattern yourself as part of your framework.</DIV><DIV>&nbsp;</DIV><DIV><a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/unit-of-work-pattern-and-persistence-ignorance" target="_blank">http://drc.ideablade.com/xwiki/bin/view/Documentation/unit-of-work-pattern-and-persistence-ignorance</A></DIV><span style="font-size:10px"><br /><br />Edited by mgood - 25-Sep-2012 at 1:37am</span>]]>
   </description>
   <pubDate>Tue, 25 Sep 2012 01:37:00 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3657&amp;PID=14572#14572</guid>
  </item> 
  <item>
   <title>Lazy Loading of Navigation Properties :   HelloI am looking for a way...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3657&amp;PID=14562#14562</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=118" rel="nofollow">LowOrbit</a><br /><strong>Subject:</strong> 3657<br /><strong>Posted:</strong> 24-Sep-2012 at 1:53pm<br /><br />Hello<div>&nbsp;</div><div>I am looking for a way to clear the loaded state of all Navigation Properties in an EntityManager so that lazy loading works as normal when a query is being re-executed. </div><div>&nbsp;</div><div>Here is an example of what I'm doing. I execute a query to get a list of&nbsp;OrderDetail which is bound into a GridView. The gridview has a column that displays the OrderDetail.Order.Id&nbsp;of each OrderDetail and also the Customer Name (OrderDetail.Order.Customer.Name) for the Order. With lazy loading turned on, the binding to OrderDetail.Order retrieves the Order Entity. And binding to Order.Customer retrieves the Customer Entity. </div><div>&nbsp;</div><div>Everything so far is good. But after some period of time, I want to be able to refresh the whole grid. With lazy loading turned on, DevForce will only refetch the OrderDetail list. It never refetches the related OrderDetail or Customer Entities. I have even tried clearing the QueryCache and it still won't refetch the related entities. </div><div>&nbsp;</div><div>I know there is a EntityReferenceStrategy that can be set to "Load" instead of "Lazy" but this completely negates the use of the cache (every reference to a navigation property will always go to the database even in it has already been fetched and is in the query cache). I also know you can set the IsLoaded property in the metadata for an entity's NavigationProperty but this requires me to loop through all the entities in my list to set this (and any other nested properties (i.e. Order to Customer, etc.)). Depending upon how many nested navigations you use, this is not practical.</div><div>&nbsp;</div><div>So, is there an easy way to tell the EntityManager to basically forget (or reset) all&nbsp;navigation properties so that when referenced, they will be lazy loaded again (only once)?</div><div>&nbsp;</div><div>Thanks!</div>]]>
   </description>
   <pubDate>Mon, 24 Sep 2012 13:53:07 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3657&amp;PID=14562#14562</guid>
  </item> 
 </channel>
</rss>