<?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 : EntityServerSaveInterceptor strategy</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : EntityServerSaveInterceptor strategy</description>
  <pubDate>Sun, 12 Apr 2026 16:15:21 -700</pubDate>
  <lastBuildDate>Wed, 29 Sep 2010 14:18:58 -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=2200</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>EntityServerSaveInterceptor strategy : Hi Mike;1. &amp;#034;In the ExecuteSave(),...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2200&amp;PID=8670#8670</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> 2200<br /><strong>Posted:</strong> 29-Sep-2010 at 2:18pm<br /><br /><div style=": rgb255, 255, 255; margin-left: 1px; margin-top: 1px; margin-right: 1px; margin-bottom: 1px; font-family: Verdana, Arial, Helvetica, sans-serif; color: rgb0, 0, 0; font-weight: normal; font-size: 12px; line-height: 1.4; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; -: n&#111;ne; ">Hi Mike;<div><br></div><div>1. "<span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px; ">In the ExecuteSave(), I'm trying to update some child entities of a transaction............</span><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px; ">It seems like since the Item will have been modified, it's not entirely in the entity graph as the EM tried to lazy load the item"</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px; "><br></span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px; ">Assuming that you have called SaveChanges(), without passing any particular entity to be saved, the EM inside the save interceptor will contain all of the Added, Modified and Deleted entities from the client. This also includes all the Added, Modified, Deleted, related items. This means that the EM should not try to lazy load your Item. Are you saying that it does try to lazy load?</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px; "><br></span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px; ">2. Regarding the best practice to prevent lazy load, the simplest way is to make the EM DefaultQueryStrategy to CacheOnly. If you need to retrieve data from the data source, then you can write a query with a With(QueryStratergy.DataSourceOnly) clause.</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px; "><br></span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">Hope this helps,</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;"><br></span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">Denis</span></div></div>]]>
   </description>
   <pubDate>Wed, 29 Sep 2010 14:18:58 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2200&amp;PID=8670#8670</guid>
  </item> 
  <item>
   <title>EntityServerSaveInterceptor strategy : I have a question about EntityServerSaveInterceptor...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2200&amp;PID=8657#8657</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> 2200<br /><strong>Posted:</strong> 28-Sep-2010 at 10:15am<br /><br />I have a question about EntityServerSaveInterceptor and the strategy when working with entities in the ExecuteSave() method.<br><br>In our application, it's multi-tenant and so the IDataSourceKeyResolver implementation requires a keyExtension for the client database with a specific keyName.<br><br>In the ExecuteSave(), I'm trying to update some child entities of a transaction.&nbsp; For instance, Order.Item.ItemHistories where the ExecuteSave() method is determining the print number for the Order and must also update a description string in the history records.<br><br>It seems like since the Item will have been modified, it's not entirely in the entity graph as the EM tried to lazy load the item and in doing so it requested a key from the IDataSourceKeyResolver but with a blank keyExtension.<br><br>So, my question is, is it best to avoid navigation properties and just look for child elements (for example em.FindEntities(ItemHistory, EntityState.Added).Where(e =&gt; e.ItemId == order.ItemId)?&nbsp; This avoids any possibility of lazy loads.&nbsp; Or, is there a way to prevent the entity manager from trying to do lazy loading in the EntityServerSaveInterceptor? What's the best practice here?<br><br>Thanks,<br>Mike<br>]]>
   </description>
   <pubDate>Tue, 28 Sep 2010 10:15:14 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2200&amp;PID=8657#8657</guid>
  </item> 
 </channel>
</rss>