<?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 : Disable Lazy Loading</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Disable Lazy Loading</description>
  <pubDate>Thu, 30 Jul 2026 00:24:07 -700</pubDate>
  <lastBuildDate>Tue, 24 May 2011 11:33:03 -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=2685</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>Disable Lazy Loading :  Nice! Thanks Stephen. Wokket;Here&amp;#039;s...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2685&amp;PID=10803#10803</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 2685<br /><strong>Posted:</strong> 24-May-2011 at 11:33am<br /><br />Nice! Thanks Stephen.<div><br></div><div>Wokket;</div><div><br></div><div>Here's a link to get you started if you want to learn how to customize DF code generation.</div><div><br></div><div><a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/custom-code-generati&#111;n-template" target="_blank">http://drc.ideablade.com/xwiki/bin/view/Documentation/custom-code-generation-template</a></div><span style="font-size:10px"><br /><br />Edited by DenisK - 24-May-2011 at 11:34am</span>]]>
   </description>
   <pubDate>Tue, 24 May 2011 11:33:03 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2685&amp;PID=10803#10803</guid>
  </item> 
  <item>
   <title>Disable Lazy Loading : For us, the simplest thing to...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2685&amp;PID=10795#10795</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> 2685<br /><strong>Posted:</strong> 23-May-2011 at 1:28pm<br /><br />For us, the simplest thing to do was to make the T4s generate static constructors for each entity in our model that disables the navigation properties. &nbsp;There might be a better way, but it seemed to work this way. &nbsp;And using static constructors, we can guarantee that the code gets executed before the particular entity's class is used. &nbsp;We made a new method (shown below) and call it from WriteEntityClass (that was a&nbsp;convenient&nbsp;place for us because we already do a lot of custom code in WriteEntityClass so we were already overriding the default&nbsp;implementation):<div><br></div><div><table width="99%"><tr><td><pre class="BBcode">&nbsp; &nbsp; &nbsp;private void WriteEntityStaticConstructor(EntityOrComplexTypeWrapper entityOrComplexType)</div><div>&nbsp; &nbsp; &nbsp;{</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; EntityTypeWrapper entityType = entityOrComplexType as EntityTypeWrapper;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //We don't use complex types so we can ignore them</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (entityType == null)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // turn off lazy loading of navigation entity relations</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WriteRegion("Static Constructor", delegate</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;WriteLine("static " + entityType.Name + "()");</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;WriteLine("{");</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;WriteRegion("Disable LazyLoading Navigation Relations", delegate&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach (var navProperty in entityType.DeclaredNavigationProperties)&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;WriteLine(String.Format(" &nbsp;PropertyMetadata.{0}.ReferenceStrategy = IbEm.EntityReferenceStrategy.NoLoad;",&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; navProperty.Name));</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;});</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;WriteLine("}");</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;WriteLine("");&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });</div><div>&nbsp; &nbsp; &nbsp;}</pre></td></tr></table></div><div><br></div><div>Note that this will disable loading for Collection navigations and Scalar ones (1-to-many and 1-to-1) - that is the behavior we wanted...basically disable all lazy loading.</div><div><br></div><div>-Stephen</div>]]>
   </description>
   <pubDate>Mon, 23 May 2011 13:28:02 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2685&amp;PID=10795#10795</guid>
  </item> 
  <item>
   <title>Disable Lazy Loading : Wokket;DevForce ignores that edmx...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2685&amp;PID=10793#10793</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 2685<br /><strong>Posted:</strong> 23-May-2011 at 12:00pm<br /><br />Wokket;<div><br></div><div>DevForce ignores that edmx property as we generate our own object context. As of now, the only way to disable lazy loading globally is by setting the EntityReferenceStrategy or by editing the T4 templates as stephenmcd1 is suggesting. I have submitted a feature request for this so we have a way to disable it through a global EntityReferenceStrategy flag.</div><div><br></div><div>Stephenmcd1;</div><div><br></div><div>we'd love to see the code sample when you get a chance to post it. Thanks!</div>]]>
   </description>
   <pubDate>Mon, 23 May 2011 12:00:00 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2685&amp;PID=10793#10793</guid>
  </item> 
  <item>
   <title>Disable Lazy Loading : We wanted to disable lazy-loading...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2685&amp;PID=10790#10790</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> 2685<br /><strong>Posted:</strong> 23-May-2011 at 9:59am<br /><br />We wanted to disable lazy-loading globally in our application as well. &nbsp;We have a lot of navigation properties and are adding new ones all the time - so manually setting the ReferenceStrategy was not really an option. &nbsp;Luckily, we've found editing the T4 templates to be pretty easy. &nbsp;And as a bonus, it's about as safe as you can get - never have to worry about forgetting a property or anything like that. &nbsp;Let me know if you want a short sample of the code we use.]]>
   </description>
   <pubDate>Mon, 23 May 2011 09:59:52 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2685&amp;PID=10790#10790</guid>
  </item> 
  <item>
   <title>Disable Lazy Loading :   G&amp;#039;day Denis,I didn&amp;#039;t...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2685&amp;PID=10776#10776</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1155" rel="nofollow">Wokket</a><br /><strong>Subject:</strong> 2685<br /><strong>Posted:</strong> 20-May-2011 at 2:13pm<br /><br />G'day Denis,<div>&nbsp;</div><div>I didn't alter the EDMX properties in code, I just flipped the "Lazy Load" property in the properties window.</div><div>&nbsp;</div><div>I've already started applying the default to each property in turn (that sounds wrong)....luckily this is only a fairly small project with 177 associations.</div><div>&nbsp;</div><div>&nbsp;</div>]]>
   </description>
   <pubDate>Fri, 20 May 2011 14:13:59 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2685&amp;PID=10776#10776</guid>
  </item> 
  <item>
   <title>Disable Lazy Loading : Hi Wokket;Thanks for letting me...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2685&amp;PID=10775#10775</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 2685<br /><strong>Posted:</strong> 20-May-2011 at 12:36pm<br /><br /><div>Hi Wokket;</div><div><br></div><div>Thanks for letting me know. Sorry for the full inbox. It's empty now. FYI, regarding your other ticket, we believe that there might be a bug there relating to threading and PendingEntityMap. We're still trying to pin it down.</div><div><br></div><div>Now, returning to your specific question here, unfortunately, I don't think we have a way to globally disabled lazy loading.&nbsp;</div><div><br></div><div>In this case, you've set the EntityReferenceStrategy.Default to .DoNotLoad, but you still have to apply it to a navigational property. For example:</div><div><br></div><div>Parent.PropertyMetadata.Children.ReferenceStrategy = EntityReferenceStrategy.Default;</div><div><br></div><div>You said that you tried disabling the LazyLoading on the .edmx properties. Is this how you've set it?</div><div><br></div><div><a href="http://stackoverflow.com/questi&#111;ns/2967214/disable-lazy-loading-by-default-in-entity-framework-4" target="_blank">http://stackoverflow.com/questions/2967214/disable-lazy-loading-by-default-in-entity-framework-4</a></div><div><br></div><div><br></div>]]>
   </description>
   <pubDate>Fri, 20 May 2011 12:36:04 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2685&amp;PID=10775#10775</guid>
  </item> 
  <item>
   <title>Disable Lazy Loading :   G&amp;#039;day again, Denis: Your...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2685&amp;PID=10753#10753</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1155" rel="nofollow">Wokket</a><br /><strong>Subject:</strong> 2685<br /><strong>Posted:</strong> 18-May-2011 at 10:08pm<br /><br />G'day again,<div> </div><div><font face="Verdana, Arial, Helvetica, sans-serif">Denis: Your PM inbox is full, but yes, that's me.</font></div><div><font face="Verdana, Arial, Helvetica, sans-serif"></font> </div><div><font face="Verdana, Arial, Helvetica, sans-serif">Thanks for the links, in typical form every search I've tried today has worked flawlessly... the wonders of technology.</font></div><div><font face="Verdana, Arial, Helvetica, sans-serif"></font> </div><div><font face="Verdana, Arial, Helvetica, sans-serif">Unfortunately despite rummaging through the docco I still haven't been able to <em>globally</em> disable lazy loading...</font></div><div><font face="Verdana, Arial, Helvetica, sans-serif"></font> </div><div><font face="Verdana, Arial, Helvetica, sans-serif">I've tried setting the default EntityReferenceStrategy as follows:</font><font color="#2b91af" face="C&#111;nsolas"><font color="#2b91af" face="C&#111;nsolas"></font></font></div><font color="#2b91af" face="C&#111;nsolas"><font color="#2b91af" face="C&#111;nsolas"><p>EntityReferenceStrategy</p></font><p></p></font><p><font face="C&#111;nsolas">.Default = </font><font color="#0000ff" face="C&#111;nsolas"><font color="#0000ff" face="C&#111;nsolas">new</font></font><font face="C&#111;nsolas"> </font><font color="#2b91af" face="C&#111;nsolas"><font color="#2b91af" face="C&#111;nsolas">EntityReferenceStrategy</font></font><font face="C&#111;nsolas">(</font><font color="#2b91af" face="C&#111;nsolas"><font color="#2b91af" face="C&#111;nsolas">EntityReferenceLoadStrategy</font></font><font face="C&#111;nsolas">.DoNotLoad, </font><font color="#2b91af" face="C&#111;nsolas"><font color="#2b91af" face="C&#111;nsolas">MergeStrategy</font></font><font face="C&#111;nsolas">.PreserveChanges);</font><p> </p><p><font face="C&#111;nsolas"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">and also disabling LazyLoading on the .edmx properties... to no avail.  I'd prefer to avoid hacking at the code-genned output (via the .tt) just to make a change like this, but that's my next step unfortunately.</font></font></p><font face="C&#111;nsolas"><div></div><div></div></font>]]>
   </description>
   <pubDate>Wed, 18 May 2011 22:08:13 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2685&amp;PID=10753#10753</guid>
  </item> 
  <item>
   <title>Disable Lazy Loading :  Originally posted by DenisKHi...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2685&amp;PID=10746#10746</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=3" rel="nofollow">JoshO</a><br /><strong>Subject:</strong> 2685<br /><strong>Posted:</strong> 18-May-2011 at 12:52pm<br /><br /><table width="99%"><tr><td class="BBquote"><strong><em>Originally posted by DenisK</strong></em><br /><br />Hi Wokket;<div><br></div><div>Have you tried this page? <a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/navigati&#111;n-properties-data-retrieval" target="_blank">http://drc.ideablade.com/xwiki/bin/view/Documentation/navigation-properties-data-retrieval</a></div><div><br></div><div>Thank you for the feedback regarding the search results. We will try to improve the search engine with this.</div></td></tr></table><div></div><div> </div><div>Strange, I tried this search myself using "lazy" and got a bunch of hits with the page linked above as the top pick. I am not sure what went wrong Wokket and I <span style='color: black; font-family: "Verdana","sans-serif"; font-size: 9pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-theme-font: minor-bidi; mso-ansi-: EN; mso-fareast-: EN-US; mso-bidi-: AR-SA;' lang="EN">apologize</span> for the difficulty.</div><div> </div><div>Anyway, this search format also works very well using Google:  <font color="#006600">site:drc.ideablade.com lazy</font></div><div>Just add your search term(s) after the "site:drc.ideablade.com"</div><div> </div><div>Google will even try to match as many letters even though the term does not exist: <em>lazyload</em> will return "lazy", "lazy load", "lazy loading"; but the search engine (Lucene) used on our wiki server will not give you any hits.</div><div> </div><div>You may also want to try refreshing the cached client-side scripts by hitting the "F5" button while browsing any of our DRC pages.</div>]]>
   </description>
   <pubDate>Wed, 18 May 2011 12:52:10 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2685&amp;PID=10746#10746</guid>
  </item> 
  <item>
   <title>Disable Lazy Loading : Hi Wokket;Have you tried this...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2685&amp;PID=10743#10743</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 2685<br /><strong>Posted:</strong> 18-May-2011 at 11:57am<br /><br />Hi Wokket;<div><br></div><div>Have you tried this page?&nbsp;<a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/navigati&#111;n-properties-data-retrieval" target="_blank">http://drc.ideablade.com/xwiki/bin/view/Documentation/navigation-properties-data-retrieval</a></div><div><br></div><div>Thank you for the feedback regarding the search results. We will try to improve the search engine with this.</div>]]>
   </description>
   <pubDate>Wed, 18 May 2011 11:57:23 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2685&amp;PID=10743#10743</guid>
  </item> 
  <item>
   <title>Disable Lazy Loading :   G&amp;#039;day guys,I&amp;#039;m running...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2685&amp;PID=10727#10727</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1155" rel="nofollow">Wokket</a><br /><strong>Subject:</strong> 2685<br /><strong>Posted:</strong> 17-May-2011 at 3:07pm<br /><br />G'day guys,<div>&nbsp;</div><div>I'm running into some hassles with background asynchronous lazy-loading of properties (fired by Silverlights Binding infrastructure) causing "Collection Modfified" exceptions inside our application.</div><div>&nbsp;</div><div>When I create a new entity, and attach it to the object graph being modified, I'm currently having to set each and every referenced entity to a new entity (via EntityManager.CreateEntity&lt;T&gt;()) in order to avoid a lazy-load lookup.</div><div>&nbsp;</div><div>I've found info from Ward here (<a href="http://forums.silverlight.net/forums/t/178991.aspx" target="_blank">http://forums.silverlight.net/forums/t/178991.aspx</a>) indicating lazyloading can be disabled, and a few forum posts indicating it can be controlled, however no relevant search results here, and no results in the documention wiki for lazy, lazyload, lazyloading etc.</div><div>&nbsp;</div><div>Can anyone provide a link to some lazy-load docco, or provide feedback on the preferred way of constructing an entity graph like this?</div><div>&nbsp;</div><div>&nbsp;</div>]]>
   </description>
   <pubDate>Tue, 17 May 2011 15:07:23 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2685&amp;PID=10727#10727</guid>
  </item> 
 </channel>
</rss>