<?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 : Blocking Async Queries</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2009 : Blocking Async Queries</description>
  <pubDate>Tue, 28 Apr 2026 19:42:04 -700</pubDate>
  <lastBuildDate>Fri, 13 Mar 2009 07:20:09 -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=1128</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>Blocking Async Queries :  Originally posted by kimjOh,...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1128&amp;PID=4062#4062</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=452" rel="nofollow">ken.nelson</a><br /><strong>Subject:</strong> 1128<br /><strong>Posted:</strong> 13-Mar-2009 at 7:20am<br /><br /><table width="99%"><tr><td class="BBquote"><strong><em>Originally posted by kimj</strong></em><br /><br />Oh, regarding why the wait blocks the UI - you can take that up with Microsoft :-).&nbsp; In order to avoid blocking the browser, they disallow any type of wait on the UI thread in Silverlight.&nbsp; A little frustrating I know, since this same logic works fine in WPF and WinForms applications.</td></tr></table> <DIV>&nbsp;</DIV><DIV>Thanks. :)&nbsp; I was more surprised than anything, like you stated, the same logic works fine in WPF and WinForms.</DIV>]]>
   </description>
   <pubDate>Fri, 13 Mar 2009 07:20:09 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1128&amp;PID=4062#4062</guid>
  </item> 
  <item>
   <title>Blocking Async Queries :  Originally posted by kimjKen,...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1128&amp;PID=4061#4061</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=452" rel="nofollow">ken.nelson</a><br /><strong>Subject:</strong> 1128<br /><strong>Posted:</strong> 13-Mar-2009 at 7:17am<br /><br /><table width="99%"><tr><td class="BBquote"><strong><em>Originally posted by kimj</strong></em><br /><br />Ken, <DIV>&nbsp;</DIV><DIV>All navigation in Silverlight will be done asynchronously if the data isn't already in cache.&nbsp; There's a property on the EntityManager called UseAsyncNavigation which for SL is always on.&nbsp; This means that something like </DIV><DIV>&nbsp;</DIV><DIV><FONT face="Times New Roman, Times, serif">&nbsp;<FONT size=3>&nbsp;&nbsp; customer.Orders</FONT></FONT></DIV><DIV>&nbsp;</DIV><DIV>will automatically be resolved asynchronously if necessary.&nbsp; You can use the IsPendingEntityList property on the RelatedEntityList to tell you whether&nbsp;"real" or "pending" data has been returned.</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var orders&nbsp;= customer.Orders;</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Assert.IsTrue(orders.IsPendingEntityList);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; orders.PendingEntityListResolved += (o, e) =&gt; {</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Now have real data</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Assert.IsFalse(orders.IsPendingEntityList);</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</DIV><DIV>&nbsp;</DIV><DIV>For scalar properties you'd use IsPendingEntity and PendingEntityResolved.</DIV><DIV></td></tr></table> </DIV><DIV>&nbsp;</DIV><DIV>That's exactly what I was looking for.&nbsp; I'm not sure how I missed the PendingEntityListResolved delegate.&nbsp; Thanks!</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Fri, 13 Mar 2009 07:17:58 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1128&amp;PID=4061#4061</guid>
  </item> 
  <item>
   <title>Blocking Async Queries :  Originally posted by smi-markIs...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1128&amp;PID=4059#4059</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=452" rel="nofollow">ken.nelson</a><br /><strong>Subject:</strong> 1128<br /><strong>Posted:</strong> 13-Mar-2009 at 7:14am<br /><br /><DIV><table width="99%"><tr><td class="BBquote"><strong><em>Originally posted by smi-mark</strong></em><br /><br />Is there no way you can wait till the derived property has populated and then call an event?<BR><BR>Ie, have a "wait" form in your SL app while it waits for the event to fire before continuing on?<BR></DIV><DIV></td></tr></table></DIV><DIV>&nbsp;</DIV><DIV>Probably, though it will take a bit of reworking our current app to do so.&nbsp; Really a big part of the reason I posted this message was to determine what is and isn't possible, so this discussion has been a big help.&nbsp; We'll just have to rethink the way we're doing certain things.</DIV><DIV>&nbsp;</DIV><DIV><table width="99%"><tr><td class="BBquote"><strong><em>Originally posted by smi-mark</strong></em><br /><br /><BR>Also, on your initial call you can do a span using .Include on the query<BR><BR>IEntityQuery query = em.Customers.Where(c =&gt; c.Id == 1).Include(Customer.OrdersEntityProperty.Name);<BR><BR>Then when the results come back you will have the orders.<BR></td></tr></table> </DIV><DIV>&nbsp;</DIV><DIV>I agree that using .Include() should solve a lot of our problems, what I'm uncertain about with that though is the accuracy if multiple concurrent users are adding/removing customer orders and say the property on Customer is an Order count.&nbsp; Any idea?</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Fri, 13 Mar 2009 07:14:14 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1128&amp;PID=4059#4059</guid>
  </item> 
  <item>
   <title>Blocking Async Queries : If i need something right away...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1128&amp;PID=4049#4049</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=449" rel="nofollow">smi-mark</a><br /><strong>Subject:</strong> 1128<br /><strong>Posted:</strong> 12-Mar-2009 at 2:31pm<br /><br />If i need something right away i usuall use include but there are a few methods of doing it as Kim has said.<br><br><b>This gets the customer and the orders belong to the customer before returning.</b><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; em.Customers.Where(c =&gt; c.Id ==1).Include(Customer.OrdersEntityProperty.Name).ExecuteAsync(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; args =&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (args.Error != null)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n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&nbsp;&nbsp; },<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; null);<br><br><b>This gets the customer, returns with the customer object, and then gets the orders.</b><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; em.Customers.Where(c =&gt; c.Id == 1).ExecuteAsync(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; args =&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (args.Error != null)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw args.Error;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Customer cust = args.Result.First();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nb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]]>
   </description>
   <pubDate>Thu, 12 Mar 2009 14:31:09 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1128&amp;PID=4049#4049</guid>
  </item> 
  <item>
   <title>Blocking Async Queries : Oh, regarding why the wait blocks...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1128&amp;PID=4047#4047</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=11" rel="nofollow">kimj</a><br /><strong>Subject:</strong> 1128<br /><strong>Posted:</strong> 12-Mar-2009 at 2:27pm<br /><br />Oh, regarding why the wait blocks the UI - you can take that up with Microsoft :-).&nbsp; In order to avoid blocking the browser, they disallow any type of wait on the UI thread in Silverlight.&nbsp; A little frustrating I know, since this same logic works fine in WPF and WinForms applications.]]>
   </description>
   <pubDate>Thu, 12 Mar 2009 14:27:05 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1128&amp;PID=4047#4047</guid>
  </item> 
  <item>
   <title>Blocking Async Queries : Ken,   All navigation in Silverlight...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1128&amp;PID=4046#4046</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=11" rel="nofollow">kimj</a><br /><strong>Subject:</strong> 1128<br /><strong>Posted:</strong> 12-Mar-2009 at 2:23pm<br /><br />Ken, <DIV>&nbsp;</DIV><DIV>All navigation in Silverlight will be done asynchronously if the data isn't already in cache.&nbsp; There's a property on the EntityManager called UseAsyncNavigation which for SL is always on.&nbsp; This means that something like </DIV><DIV>&nbsp;</DIV><DIV><FONT face="Times New Roman, Times, serif">&nbsp;<FONT size=3>&nbsp;&nbsp; customer.Orders</FONT></FONT></DIV><DIV>&nbsp;</DIV><DIV>will automatically be resolved asynchronously if necessary.&nbsp; You can use the IsPendingEntityList property on the RelatedEntityList to tell you whether&nbsp;"real" or "pending" data has been returned.</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var orders&nbsp;= customer.Orders;</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Assert.IsTrue(orders.IsPendingEntityList);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; orders.PendingEntityListResolved += (o, e) =&gt; {</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Now have real data</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Assert.IsFalse(orders.IsPendingEntityList);</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</DIV><DIV>&nbsp;</DIV><DIV>For scalar properties you'd use IsPendingEntity and PendingEntityResolved.</DIV><DIV>&nbsp;</DIV><DIV>It looks like we need to trap and disallow&nbsp;attempts to call ExecuteAsyncQuery on the navigation properties, since as you found&nbsp;this doesn't work.&nbsp;<BR></DIV>]]>
   </description>
   <pubDate>Thu, 12 Mar 2009 14:23:21 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1128&amp;PID=4046#4046</guid>
  </item> 
  <item>
   <title>Blocking Async Queries : Is there no way you can wait till...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1128&amp;PID=4045#4045</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=449" rel="nofollow">smi-mark</a><br /><strong>Subject:</strong> 1128<br /><strong>Posted:</strong> 12-Mar-2009 at 1:36pm<br /><br />Is there no way you can wait till the derived property has populated and then call an event?<br><br>Ie, have a "wait" form in your SL app while it waits for the event to fire before continuing on?<br><br>Also, on your initial call you can do a span using .Include on the query<br><br>IEntityQuery query = em.Customers.Where(c =&gt; c.Id == 1).Include(Customer.OrdersEntityProperty.Name);<br><br>Then when the results come back you will have the orders.<br>]]>
   </description>
   <pubDate>Thu, 12 Mar 2009 13:36:02 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1128&amp;PID=4045#4045</guid>
  </item> 
  <item>
   <title>Blocking Async Queries : Ok, we&amp;#039;ve now got our machines...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1128&amp;PID=4044#4044</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=452" rel="nofollow">ken.nelson</a><br /><strong>Subject:</strong> 1128<br /><strong>Posted:</strong> 12-Mar-2009 at 1:12pm<br /><br />Ok, we've now got our machines working using SL, so I was finally able to test this, and you're right in that it locks up the browser, but I'm still confused as to why.&nbsp; I would expect it to lock up for the period of time that it took to complete the async query, in which case, we'd work out some method of throwing up a progress updater, but it seems to just lock up entirely.&nbsp; I guess we're just going to have to live with not having the derived properties. <DIV>&nbsp;</DIV><DIV>One follow on&nbsp;question about&nbsp;Navigation Properties, we have a need to iterate over the collection that the navigation property would return, but obviously navigation properties are also async, so we can't really do that until the async completes.&nbsp; I can't seem to figure out how to hook in a 'Completed' callback to a navigation property.&nbsp; I tried doing something like the following but got a compile error:</DIV><DIV>&nbsp;</DIV><DIV><FONT face="Courier New, Courier, mono">IEntityQuery query = customer.Orders;</FONT></DIV><DIV><FONT face="Courier New, Courier, mono">em.ExecuteQueryAsync(query, QueryCompleted, null);</FONT></DIV><DIV>&nbsp;</DIV><DIV>I then tried the following, but got a runtime error:</DIV><DIV>&nbsp;</DIV><DIV><DIV><FONT face="Courier New, Courier, mono">IEntityQuery query = customer.Orders.ToQuery();</FONT></DIV><DIV><FONT face="Courier New, Courier, mono">em.ExecuteQueryAsync(query, QueryCompleted, null);</FONT></DIV></DIV><DIV>&nbsp;</DIV><DIV>The only way I could work it out was to do the following:</DIV><DIV>&nbsp;</DIV><DIV><DIV><DIV><FONT face="Courier New, Courier, mono">IEntityQuery query = em.Orders.Where(i =&gt; i.CustomerID == customer.UniqueID);</FONT></DIV><DIV><FONT face="Courier New, Courier, mono">em.ExecuteQueryAsync(query, QueryCompleted, null);</FONT></DIV><DIV>&nbsp;</DIV><DIV>Basically, I've got to ignore that a navigation property exists, and just control it manually.&nbsp; Is there a better way to handle this?</DIV><DIV>&nbsp;</DIV><DIV>Thanks,</DIV><DIV>Ken</DIV></DIV></DIV>]]>
   </description>
   <pubDate>Thu, 12 Mar 2009 13:12:40 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1128&amp;PID=4044#4044</guid>
  </item> 
  <item>
   <title>Blocking Async Queries :  Originally posted by kimj Glad...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1128&amp;PID=4040#4040</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=452" rel="nofollow">ken.nelson</a><br /><strong>Subject:</strong> 1128<br /><strong>Posted:</strong> 12-Mar-2009 at 6:08am<br /><br /><table width="99%"><tr><td class="BBquote"><strong><em>Originally posted by kimj</strong></em><br /><br /><P>Glad the IEntityManagerAsync might be useful.&nbsp; Although, I'm still leery that these blocking calls will block the entire UI and effectively crash the browser.&nbsp; Have you used them successfully in SL?</P></td></tr></table> <DIV>&nbsp;</DIV><DIV>We've not yet tried the above solution in SL, our entire office is currently having some difficulty getting DevForce EF running properly using SL (See <a href="http://www.ideablade.com/forum/forum_posts.asp?TID=1127" target="_blank">http://www.ideablade.com/forum/forum_posts.asp?TID=1127</A>&nbsp;if you're interested in that).&nbsp; Once we can successfully run, I'll post an update.</DIV>]]>
   </description>
   <pubDate>Thu, 12 Mar 2009 06:08:40 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1128&amp;PID=4040#4040</guid>
  </item> 
  <item>
   <title>Blocking Async Queries : Glad the IEntityManagerAsync might...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1128&amp;PID=4031#4031</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=11" rel="nofollow">kimj</a><br /><strong>Subject:</strong> 1128<br /><strong>Posted:</strong> 11-Mar-2009 at 9:36am<br /><br /><P>Glad the IEntityManagerAsync might be useful.&nbsp; Although, I'm still leery that these blocking calls will block the entire UI and effectively crash the browser.&nbsp; Have you used them successfully in SL?</P>]]>
   </description>
   <pubDate>Wed, 11 Mar 2009 09:36:57 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1128&amp;PID=4031#4031</guid>
  </item> 
  <item>
   <title>Blocking Async Queries :  Originally posted by kimj DevForce...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1128&amp;PID=4027#4027</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=452" rel="nofollow">ken.nelson</a><br /><strong>Subject:</strong> 1128<br /><strong>Posted:</strong> 11-Mar-2009 at 3:45am<br /><br /><table width="99%"><tr><td class="BBquote"><strong><em>Originally posted by kimj</strong></em><br /><br /><P>DevForce also supports asynchronous navigation and returns a PendingEntity or PendingEntityList for navigation properties which must be fulfilled asynchronously.&nbsp; Looks like this feature isn't yet in the Developer's Guide, but check out the Release Notes for more information (the feature was introduced in v4.2.0).</P><DIV>Also, be careful with any waits or sleeps or otherwise blocking the UI thread in Silverlight.&nbsp;&nbsp; Something like</DIV><DIV>&nbsp;&nbsp; &nbsp;<FONT face="Courier New">while (!worksAloneCompleted);</FONT></DIV><DIV>could block the thread and leave the SL application hanging.</DIV></td></tr></table> <DIV>&nbsp;</DIV><DIV>The PendingEntityList will definitely help for other properties, that's a good bit of info, can I suggest adding that to the developer's guide?</DIV><DIV>&nbsp;</DIV><DIV>What actually looks like the fix I was looking for was also in the release notes for v4.2.0, so thanks for pointing me to that document:</DIV><DIV>&nbsp;</DIV><DIV><table width="99%"><tr><td class="BBquote"></DIV><DIV>For those needing additional control over their asynchronous operations the EntityManager also supports the IAsyncResult asynchronous pattern through an explicit implementation of the IEntityManagerAsync interface. You will need to cast an EntityManager to this interface in order to use methods following this pattern. In the IAsyncResult pattern an asynchronous operation is implemented as two methods named BeginOperationName and EndOperationName to begin and end the asynchronous operation "OperationName". More information on using this interface is available in the DevForce Framework Help reference.</DIV><DIV></td></tr></table></DIV><DIV>&nbsp;</DIV><DIV>This allows us to block the async in a much cleaner way.</DIV><DIV>&nbsp;</DIV><DIV><FONT face="Courier New, Courier, mono">IEntityQuery&lt;Employee&gt; query = em.Employee.Where(i =&gt; i.Location == this.Location);<BR>IAsyncResult result = (em as IEntityManagerAsync).BeginExecuteQuery&lt;Employee&gt;(query, null, null);</FONT></DIV><DIV><FONT face="Courier New, Courier, mono">while (!result.IsCompleted);</FONT></DIV><DIV><FONT face="Courier New, Courier, mono">IEnumerable&lt;Employee&gt;&nbsp;x = (em as IEntityManagerAsync).EndExecuteQuery&lt;Employee&gt;(result);</FONT></DIV><DIV><FONT face="Courier New, Courier, mono"></FONT>&nbsp;</DIV><DIV><FONT face="Courier New, Courier, mono">return (x.Count() == 1);</FONT></DIV>]]>
   </description>
   <pubDate>Wed, 11 Mar 2009 03:45:27 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1128&amp;PID=4027#4027</guid>
  </item> 
  <item>
   <title>Blocking Async Queries :   Originally posted by kimj  DevForce...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1128&amp;PID=4026#4026</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=452" rel="nofollow">ken.nelson</a><br /><strong>Subject:</strong> 1128<br /><strong>Posted:</strong> 11-Mar-2009 at 3:08am<br /><br /><DIV>&nbsp;</DIV><DIV><table width="99%"><tr><td class="BBquote"><strong><em>Originally posted by kimj</strong></em><br /><br /></DIV><DIV>&nbsp;</DIV><DIV>DevForce also supports asynchronous navigation and returns a PendingEntity or PendingEntityList for navigation properties which must be fulfilled asynchronously.&nbsp; Looks like this feature isn't yet in the Developer's Guide, but check out the Release Notes for more information (the feature was introduced in v4.2.0).</DIV><DIV>&nbsp;</DIV></td></tr></table> <DIV>&nbsp;</DIV><DIV>I haven't looked into this yet, but hopefully it'll help, I'll update this post if it does.&nbsp; Thanks.</DIV><DIV>&nbsp;</DIV><DIV><DIV><table width="99%"><tr><td class="BBquote"><strong><em>Originally posted by kimj</strong></em><br /><br /></DIV><DIV>&nbsp;</DIV></DIV><DIV>Also, be careful with any waits or sleeps or otherwise blocking the UI thread in Silverlight.&nbsp;&nbsp; Something like</DIV><DIV>&nbsp;&nbsp; &nbsp;<FONT face="Courier New">while (!worksAloneCompleted);</FONT></DIV><DIV>could block the thread and leave the SL application hanging.</DIV><P></td></tr></table> </P><DIV>Yeah, unfortunately it may be what we have to do.&nbsp; This property has to return the correct value on each and every call.</DIV>]]>
   </description>
   <pubDate>Wed, 11 Mar 2009 03:08:33 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1128&amp;PID=4026#4026</guid>
  </item> 
  <item>
   <title>Blocking Async Queries : Hi smi-mark,  The trouble is,...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1128&amp;PID=4025#4025</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=452" rel="nofollow">ken.nelson</a><br /><strong>Subject:</strong> 1128<br /><strong>Posted:</strong> 11-Mar-2009 at 3:03am<br /><br /><DIV>Hi smi-mark,</DIV><DIV>&nbsp;</DIV><DIV>The trouble is, for our use case we're not binding to this property, we're using it in computations, and that computation has to be correct the first time through.&nbsp; That, and the value can change frequently so performing the lazy load and storing a member variable doesn't work for us.&nbsp; So, while in many cases your solution would likely be preferred, it's not really what we're looking to do.&nbsp; Thanks though, I appreciate the feedback!</DIV><span style="font-size:10px"><br /><br />Edited by ken.nelson - 11-Mar-2009 at 3:05am</span>]]>
   </description>
   <pubDate>Wed, 11 Mar 2009 03:03:07 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1128&amp;PID=4025#4025</guid>
  </item> 
  <item>
   <title>Blocking Async Queries : Although maybe not appropriate...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1128&amp;PID=4023#4023</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=11" rel="nofollow">kimj</a><br /><strong>Subject:</strong> 1128<br /><strong>Posted:</strong> 10-Mar-2009 at 10:55pm<br /><br /><P>Although maybe not appropriate here, when the situation allows it and the necessary data is already in cache you can set the QueryStrategy to CacheOnly and execute a synchronous query.&nbsp; When things get messy with async queries, pre-loading can be a good idea.</P><DIV>DevForce also supports asynchronous navigation and returns a PendingEntity or PendingEntityList for navigation properties which must be fulfilled asynchronously.&nbsp; Looks like this feature isn't yet in the Developer's Guide, but check out the Release Notes for more information (the feature was introduced in v4.2.0).</DIV><DIV>&nbsp;</DIV><DIV>Also, be careful with any waits or sleeps or otherwise blocking the UI thread in Silverlight.&nbsp;&nbsp; Something like</DIV><DIV>&nbsp;&nbsp; &nbsp;<FONT face="Courier New">while (!worksAloneCompleted);</FONT></DIV><DIV>could block the thread and leave the SL application hanging.</DIV>]]>
   </description>
   <pubDate>Tue, 10 Mar 2009 22:55:57 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1128&amp;PID=4023#4023</guid>
  </item> 
  <item>
   <title>Blocking Async Queries : Hi,Could you do something similar...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1128&amp;PID=4016#4016</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=449" rel="nofollow">smi-mark</a><br /><strong>Subject:</strong> 1128<br /><strong>Posted:</strong> 10-Mar-2009 at 5:06pm<br /><br />Hi,<br><br>Could you do something similar to this:<br><br>&nbsp;&nbsp;&nbsp; private bool mComputedPropertyInitialized;<br>&nbsp;&nbsp;&nbsp; private int mComputedProperty = -1;<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; public int ComputedProperty {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; get {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (mComputedPropertyInitialized) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return mComputedProperty;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EntityManager em = this.EntityManager;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EntityQuery&lt;User&gt; query = new EntityQuery&lt;User&gt;();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; em.ExecuteQueryAsync(query, user_asyncCallback, null);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 0;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //or another default value<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; private void user_asynccallback(EntityFetchedEventArgs&lt;User&gt; pArgs)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //process result<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mComputedProperty = 1;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mComputedPropertyInitialized = true;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.EntityAspect.ForcePropertyChanged(null);<br>&nbsp;&nbsp;&nbsp; }<br><br>That way it will return your default until the async has been completed and then force rebinding with forcepropertychanged when it returns.<br>]]>
   </description>
   <pubDate>Tue, 10 Mar 2009 17:06:12 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1128&amp;PID=4016#4016</guid>
  </item> 
  <item>
   <title>Blocking Async Queries : Hi,  We&amp;#039;re writing a Silverlight...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1128&amp;PID=4014#4014</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=452" rel="nofollow">ken.nelson</a><br /><strong>Subject:</strong> 1128<br /><strong>Posted:</strong> 10-Mar-2009 at 1:46pm<br /><br /><FONT face="Verdana, Arial, Helvetica, sans-serif">Hi,</FONT><DIV>&nbsp;</DIV><DIV><FONT face="Verdana, Arial, Helvetica, sans-serif">We're writing a Silverlight application using DevForceEF.&nbsp; We've a number of properties on our classes that are 'derived', meaning they're not directly bound to a column in the database, and they are computed on-the-fly.&nbsp; Here's a bad example of the type of thing I'm talking about:</FONT></DIV><DIV>&nbsp;</DIV><DIV><FONT face="Courier New, Courier, mono">public partial class Employee<BR>{<BR>&nbsp;&nbsp; public bool WorksAlone<BR>&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; get<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;MyEntityManager em = this.EntityManager as MyEntityManager;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;int count = em.Employees.Where(i =&gt; i.Location == this.Location).Count();</FONT></DIV><DIV><FONT face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;return (count == 1);<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;}<BR>&nbsp; &nbsp;}</FONT></DIV><DIV><FONT face="Courier New, Courier, mono">}</FONT></DIV><DIV><FONT face="Courier New"></FONT>&nbsp;</DIV><DIV><FONT face="Verdana, Arial, Helvetica, sans-serif">The problem is that Silverlight requires the queries be executed asyncronously, which is fine in most cases, but with respect to a derived property like the example above, it becomes tricky.&nbsp; Typically we'd use an IAsyncResult and simply wait until the Async call completed before returning the result, but I can't seem to figure out how to do this with DevForce.&nbsp; The only thing I can seem to make work at all feels really dirty.</FONT></DIV><DIV><FONT face="Courier New"></FONT>&nbsp;</DIV><DIV><FONT face="Courier New, Courier, mono">public partial class Employee<BR>{<BR></FONT><FONT face="Courier New, Courier, mono">&nbsp;&nbsp; public bool WorksAlone<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; get<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bool result = false;</FONT></DIV><DIV><FONT face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;MyEntityManager em = this.EntityManager as MyEntityManager;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;if (em != null)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;IEntityQuery&lt;Employee&gt; query = em.Emplyoees.Where(i =&gt; i.Location == this.Location);</FONT></DIV><DIV><FONT face="Courier New"></FONT>&nbsp;</DIV><DIV><FONT face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;worksAloneCompleted = false;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;em.ExecuteQueryAsync(query, new AsyncCompletedCallback&lt;EntityFetchedEventArgs&gt;(WorksAloneCompleted), null);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;while (!worksAloneCompleted);</FONT></DIV><DIV><FONT face="Courier New"></FONT>&nbsp;</DIV><DIV><FONT face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;result = worksAloneResult;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;}</FONT></DIV><DIV><BR><FONT face="Courier New, Courier, mono">&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;return result;<BR>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp; }</FONT></DIV><DIV><FONT face="Courier New"></FONT>&nbsp;</DIV><DIV><FONT face="Courier New, Courier, mono">&nbsp;&nbsp; private bool worksAloneCompleted = false;<BR>&nbsp;&nbsp; private bool worksAloneResult = false;<BR>&nbsp;&nbsp; private void WorksAloneCompleted(EntityFetchedEventArgs args)<BR>&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int count = 0;<BR>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;foreach (var item in args.Result)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;count++;</FONT></DIV><DIV><FONT face="Courier New"></FONT>&nbsp;</DIV><DIV><FONT face="Courier New, Courier, mono">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;worksAloneResult = (count == 1);<BR>&nbsp;&nbsp; &nbsp; &nbsp;worksAloneCompleted = true;<BR>&nbsp;&nbsp; }<BR>}</FONT></DIV><DIV><FONT face="Courier New"></FONT>&nbsp;</DIV><DIV><FONT face="Verdana, Arial, Helvetica, sans-serif">Do you have any other recommendations how to handle this?</FONT></DIV><DIV>&nbsp;</DIV><DIV>Thanks,</DIV><DIV>Ken</DIV>]]>
   </description>
   <pubDate>Tue, 10 Mar 2009 13:46:09 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1128&amp;PID=4014#4014</guid>
  </item> 
 </channel>
</rss>