<?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 : Querying during Save Interceptor?</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Querying during Save Interceptor?</description>
  <pubDate>Tue, 12 May 2026 23:20:09 -700</pubDate>
  <lastBuildDate>Thu, 25 Oct 2012 12:27:31 -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=3633</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>Querying during Save Interceptor? :    DevForce 2010 6.1.9 will...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3633&amp;PID=14972#14972</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=892" rel="nofollow">sbelini</a><br /><strong>Subject:</strong> 3633<br /><strong>Posted:</strong> 25-Oct-2012 at 12:27pm<br /><br /> DevForce 2010 6.1.9 will be released within the next 2 weeks.]]>
   </description>
   <pubDate>Thu, 25 Oct 2012 12:27:31 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3633&amp;PID=14972#14972</guid>
  </item> 
  <item>
   <title>Querying during Save Interceptor? :   Originally posted by sbelini  We...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3633&amp;PID=14956#14956</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> 3633<br /><strong>Posted:</strong> 24-Oct-2012 at 10:34am<br /><br /><table width="99%"><tr><td class="BBquote"><strong><em>Originally posted by sbelini</strong></em><br /><br />We are planning on having a DF2010 release late this month.<div></td></tr></table></div><div><br></div><div>Any updates on when the official version might be coming out? &nbsp;It's getting close to the end of the month :-).</div><div><br></div><div>Thanks!</div>]]>
   </description>
   <pubDate>Wed, 24 Oct 2012 10:34:26 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3633&amp;PID=14956#14956</guid>
  </item> 
  <item>
   <title>Querying during Save Interceptor? : A patch build would be nice. We...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3633&amp;PID=14737#14737</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> 3633<br /><strong>Posted:</strong> 04-Oct-2012 at 10:08am<br /><br />A patch build would be nice. &nbsp;We were hoping to get this fixed in the next 2 weeks.....and it sounds like the official release wouldn't be ready by then.]]>
   </description>
   <pubDate>Thu, 04 Oct 2012 10:08:24 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3633&amp;PID=14737#14737</guid>
  </item> 
  <item>
   <title>Querying during Save Interceptor? :   We are planning on having...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3633&amp;PID=14730#14730</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=892" rel="nofollow">sbelini</a><br /><strong>Subject:</strong> 3633<br /><strong>Posted:</strong> 03-Oct-2012 at 4:47pm<br /><br />We are planning on having a DF2010 release late this month.<div>If you prefer, I can provide you with a patch.</div><div>Let me know.</div>]]>
   </description>
   <pubDate>Wed, 03 Oct 2012 16:47:43 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3633&amp;PID=14730#14730</guid>
  </item> 
  <item>
   <title>Querying during Save Interceptor? : Do you have an estimate for when...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3633&amp;PID=14727#14727</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> 3633<br /><strong>Posted:</strong> 03-Oct-2012 at 3:07pm<br /><br />Do you have an estimate for when the next release will be? &nbsp;I know DF2012 is probably your main focus at the moment but we'll probably be on DF2010 for at least a little while and we'd want this issue fixed.]]>
   </description>
   <pubDate>Wed, 03 Oct 2012 15:07:59 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3633&amp;PID=14727#14727</guid>
  </item> 
  <item>
   <title>Querying during Save Interceptor? :   Hi Stephen, This problem has...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3633&amp;PID=14500#14500</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=892" rel="nofollow">sbelini</a><br /><strong>Subject:</strong> 3633<br /><strong>Posted:</strong> 21-Sep-2012 at 1:00pm<br /><br />Hi Stephen, <div>&nbsp;</div><div>This problem has been fixed and will be available in our next release.</div><div>In the meantime, you should restore the DefatulQueryStrategy manually.</div><div>&nbsp;</div><div>Regards,</div><div>&nbsp;&nbsp; Silvio.</div>]]>
   </description>
   <pubDate>Fri, 21 Sep 2012 13:00:50 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3633&amp;PID=14500#14500</guid>
  </item> 
  <item>
   <title>Querying during Save Interceptor? : We ran into some odd behavior...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3633&amp;PID=14467#14467</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> 3633<br /><strong>Posted:</strong> 18-Sep-2012 at 11:02am<br /><br />We ran into some odd behavior in our custom Save Interceptor that I've tracked down to some DevForce logic that confuses me. &nbsp;Some background:<div><br></div><div>We have a custom Save Interceptor that overrides ExecuteSave() and does some logic before and after we call base.ExecuteSave(). &nbsp;Often times we executes queries against the EntityManager. &nbsp;We've noticed that if we execute a query before base.ExecuteSave(), then by the time base.ExecuteSave() finishes, the EntityManager will have its DefaultQueryStrategy set to CacheOnly. &nbsp;That ends up messing with the queries we execute after base.ExecuteSave() since they never make it to the Data Source. &nbsp;We could just force them to be DataSource only but that seems excessive and I'm wondering why the entity manager gets forced to Cache Only in the first place.</div><div><br></div><div>Tracing through a bit of the DevForce code, it seems that whenever an entity is added or removed from the Entity Manager during a Save (which happens when I query for an entity), the EntityServerSaveInterceptor sets WorkStateNeedsUpdate to true (which makes sense). &nbsp;But then when UpdateWorkState is called, it ends up forcing the entity manager to Cache Only - which I don't understand (although, I wouldn't be surprised if there is a good reason).</div><div><br></div><div>Here is some sample code to illustrate our problem:<table width="99%"><tr><td><pre class="BBcode">&nbsp; &nbsp;public class TestSaveInterceptor : EntityServerSaveInterceptor</div><div>&nbsp; &nbsp;{</div><div>&nbsp; &nbsp; &nbsp; &nbsp; protected override bool ExecuteSave()</div><div>&nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // These are two entity keys that we know will always exist in our DB.&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is used as an example of one way we execute queries</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var keyThatExists1 = new EntityKey(typeof(Thing), 1);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var keyThatExists2 = new EntityKey(typeof(Thing), 2);</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //If it's the 13th, load the first thing (yes, obviously not our actual code)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(DateTime.Today.Day == 13)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var thing1 = keyThatExists1.ToKeyQuery(EntityManager).Execute().Single();</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Do the normal save</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var result = base.ExecuteSave();</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //If it is a Friday, load the second thing</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(DateTime.Today.DayOfWeek == DayOfWeek.Friday)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var thing2 = keyThatExists2.ToKeyQuery(EntityManager).Execute().Single();</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //As long as it isn't Friday *and* the 13th, this code will run fine. &nbsp;If only one of the queries runs,</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // &nbsp;there are no problems. &nbsp;It's just when they both run that the problem comes up since the first query</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // &nbsp;causes the entity manager to be in CacheOnly which means the second query doesn't return any results</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // &nbsp;(since thing 2 isn't in our cache) which then breaks the call to 'Single'.</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return result;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; }</pre></td></tr></table></div><div><br></div><div>I'm not sure whether I'm just not supposed to be doing queries during save or maybe this is a bug. &nbsp;Or maybe I should just clear out the Entity Manager's DefaultQueryStrategy after the call to base.ExecuteSave(), or ....</div><div><br></div><div>Thanks,</div><div>-Stephen</div>]]>
   </description>
   <pubDate>Tue, 18 Sep 2012 11:02:43 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3633&amp;PID=14467#14467</guid>
  </item> 
 </channel>
</rss>