<?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 : Tech Tip: Asynchronous Queries</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce Classic : Tech Tip: Asynchronous Queries</description>
  <pubDate>Sat, 11 Apr 2026 13:48:13 -700</pubDate>
  <lastBuildDate>Wed, 30 May 2007 18:42:27 -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=30</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>Tech Tip: Asynchronous Queries :   Tech Tip: Asynchronous Queries Level...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=30&amp;PID=90#90</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=21" rel="nofollow">IdeaBlade</a><br /><strong>Subject:</strong> 30<br /><strong>Posted:</strong> 30-May-2007 at 6:42pm<br /><br /><FONT face="Times New Roman" size=3><strong><EM><DIV><FONT face="Arial, Helvetica, sans-serif">&nbsp;</FONT></DIV><DIV><FONT face="Arial, Helvetica, sans-serif" size=5>Tech Tip: Asynchronous Queries</FONT></DIV><DIV><FONT face="Arial, Helvetica, sans-serif">Level 300 <BR>DevForce Professional</FONT></EM></strong></FONT></DIV><P style="MARGIN: 0in 0in 0pt" ="Questi&#111;n"><strong><EM><FONT face="Arial, Helvetica, sans-serif" size=3>April 25, 2006</FONT></EM></strong></P><P style="MARGIN: 8pt 0in 0pt" ="Ms&#111;normal"><FONT face="Arial, Helvetica, sans-serif" size=2>DevForce now supports asynchronous queries. An asynchronous query is a query that runs in the background on a separate thread while the user continues his/her current work without interruption. One version of asynchronous queries supports the ability to repeatedly execute the same query at a specified interval. This can be used to ensure that a client application is constantly up to date with the most current relevant data. Any number of asynchronous queries can be carried out simultaneously, limited solely by the availability of threads on the client machine. </FONT></P><P style="MARGIN: 8pt 0in 0pt" ="Ms&#111;normal"><FONT face="Arial, Helvetica, sans-serif" size=2>Asynchronous queries are invoked in almost the same fashion as a regular query. In fact, any query can be executed asynchronously by simply calling one of the PersistenceManager.GetEntitiesAsync() overloads. </FONT></P><P style="MARGIN: 8pt 0in 0pt" ="Ms&#111;normal"><?:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><O:P><FONT face="Arial, Helvetica, sans-serif" size=2>&nbsp;</FONT></O:P></P><P style="MARGIN: 8pt 0in 0pt" ="Ms&#111;normal"><FONT size=2><FONT face="Times New Roman">&nbsp;<SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></FONT><B><SPAN style="FONT-FAMILY: Verdana">C#:</SPAN></B><SPAN style="FONT-FAMILY: Verdana; mso-bidi-font-size: 10.0pt"> <O:P></O:P></SPAN></FONT></P><P style="MARGIN: 8pt 0in 0pt" ="Ms&#111;normal"><O:P><FONT face="Times New Roman" size=2>&nbsp;</FONT></O:P></P><P style="MARGIN: 0in 0in 0pt 0.25in" ="CodeSnippet"><I><SPAN style="COLOR: #669966"><FONT face="Courier New" size=2><strong>// Get the Default PersistenceManager.</strong></FONT></SPAN></I><SPAN style="FONT-FAMILY: Verdana; mso-bidi-font-size: 10.0pt"><BR></SPAN><FONT face="Courier New" color=#808080 size=2><strong>PersistenceManager pm = PersistenceManager.DefaultManager;</strong></FONT></P><P style="MARGIN: 0in 0in 0pt 0.25in" ="CodeSnippet"><I><SPAN style="COLOR: #669966"><FONT face="Courier New" size=2><strong>// This is the query for all orders placed within the last 7 days.</strong></FONT></SPAN></I><I><SPAN style="COLOR: #669966; FONT-FAMILY: Verdana; mso-bidi-font-size: 10.0pt"><BR></SPAN></I><FONT size=2><FONT face="Courier New" color=#808080><strong>RdbQuery query1 = new RdbQuery(typeof(Order),<BR>Order.OrderDateEntityColumn, EntityQueryOp.GT, <BR>DateTime.Today - new TimeSpan(7, 0, 0, 0));</strong></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt 0.25in" ="CodeSnippet"><I><SPAN style="COLOR: #669966"><FONT face="Courier New" size=2><strong>// Register an event handler to be called when the query completes.</strong></FONT></SPAN></I><I><SPAN style="COLOR: #669966; FONT-FAMILY: Verdana; mso-bidi-font-size: 10.0pt"><BR></SPAN></I><FONT face="Courier New" color=#808080 size=2><strong>pm.GetEntitiesCompleted += new EventHandler(pm_GetEntitiesCompleted);</strong></FONT></P><P style="MARGIN: 0in 0in 0pt 0.25in" ="CodeSnippet"><I><SPAN style="COLOR: #669966"><FONT face="Courier New" size=2><strong>// Start the executing query.<BR>// when it completes, the pm_GetEntitiesCompleted <BR>// referenced above will be called.<BR>// The token "anyValue" will be returned in the <BR>// GetEntitiesCompletedEventArgs to distinguish <BR>// this async call from any others.</strong></FONT></SPAN></I><I><SPAN style="COLOR: #669966; FONT-FAMILY: Verdana; mso-bidi-font-size: 10.0pt"><BR></SPAN></I><strong><FONT face="Courier New" color=#808080 size=2>pm.GetEntitiesAsync(q, QueryStrategy.DataSourceOnly, "anyValue");</FONT></strong></P><P style="MARGIN: 8pt 0in 0pt" ="Ms&#111;normal"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: Helvetica; mso-bidi-font-family: 'Times New Roman'"><O:P>&nbsp;</O:P></SPAN></P><P style="MARGIN: 8pt 0in 0pt" ="Ms&#111;normal"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: Helvetica; mso-bidi-font-family: 'Times New Roman'">&nbsp;</SPAN><FONT size=2><SPAN style="mso-tab-count: 1"><FONT face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><B><SPAN style="FONT-FAMILY: Verdana">VB.NET:</SPAN></B><SPAN style="FONT-FAMILY: Verdana; mso-bidi-font-size: 10.0pt"> </SPAN></FONT></P><P style="MARGIN: 5pt 0in; LINE-HEIGHT: 13pt" ="Ms&#111;normal"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: Helvetica; mso-bidi-font-family: 'Times New Roman'"><O:P>&nbsp;</O:P></SPAN></P><P style="MARGIN: 0in 0in 0pt 0.25in" ="CodeSnippet"><I><SPAN style="COLOR: #669966"><FONT face="Courier New" size=2><strong>' Get the Default PersistenceManager.</strong></FONT></SPAN></I><I><SPAN style="COLOR: #669966; FONT-FAMILY: Verdana; mso-bidi-font-size: 10.0pt"><BR></SPAN></I><FONT face="Courier New" color=#808080 size=2><strong>Dim pm As PersistenceManager = PersistenceManager.DefaultManager</strong></FONT></P><P style="MARGIN: 0in 0in 0pt 0.25in" ="CodeSnippet"><FONT size=2><FONT><strong><FONT face="Courier New"><I><SPAN style="COLOR: #669966">' This is the query for all orders placed within the last 7 days</SPAN></I><SPAN style="COLOR: #669966">.</SPAN></FONT></strong></FONT></FONT><SPAN style="COLOR: #669966; FONT-FAMILY: Verdana; mso-bidi-font-size: 10.0pt"><BR></SPAN><FONT size=2><FONT face="Courier New" color=#808080><strong>Dim q As RdbQuery = New RdbQuery (GetType (Order), _<BR>Order.OrderDateEntityColumn, EntityQueryOp.GT, _ <BR>DateTime.Today - New TimeSpan(7, 0, 0, 0))</strong></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt 0.25in" ="CodeSnippet"><I><SPAN style="COLOR: #669966"><FONT face="Courier New" size=2><strong>' Register an event handler to be called when the query completes.</strong></FONT></SPAN></I><SPAN style="COLOR: #669966; FONT-FAMILY: Verdana; mso-bidi-font-size: 10.0pt"><BR></SPAN><SPAN style="COLOR: black"><FONT face="Courier New" size=2><strong>AddHandler pm.GetEntitiesCompleted, AddressOf _<BR>New EventHandler(Of GetEntitiesCompletedEventArgs) _<BR>(pm_GetEntitiesCompleted)</strong></FONT></SPAN></P><P style="MARGIN: 0in 0in 0pt 0.25in" ="CodeSnippet"><I><SPAN style="COLOR: #669966"><FONT face="Courier New" size=2><strong>' Start the executing query. <BR>' When it completes, the pm_GetEntitiesCompleted referenced above<BR>' will be called. <BR>' The token "anyValue" will be returned in the <BR>' GetEntitiesCompletedEventArgs to distinguish<BR>' this async call from any others.</strong></FONT></SPAN></I><SPAN style="COLOR: #669966; FONT-FAMILY: Verdana; mso-bidi-font-size: 10.0pt"><BR></SPAN><strong><FONT size=2><FONT face="Courier New" color=#808080>pm.GetEntitiesAsync(q, QueryStrategy.DataSourceOnly, _<BR>"anyValue")</P><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV></FONT></FONT></strong><span style="font-size:10px"><br /><br />Edited by IdeaBlade - 30-May-2007 at 6:54pm</span>]]>
   </description>
   <pubDate>Wed, 30 May 2007 18:42:27 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=30&amp;PID=90#90</guid>
  </item> 
 </channel>
</rss>