<?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 : Custom Coroutine Operation</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Custom Coroutine Operation</description>
  <pubDate>Wed, 15 Apr 2026 12:22:30 -700</pubDate>
  <lastBuildDate>Tue, 21 Dec 2010 07:32:29 -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=2382</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>Custom Coroutine Operation : Ahh I see, that makes sense. Thanks!...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2382&amp;PID=9445#9445</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> 2382<br /><strong>Posted:</strong> 21-Dec-2010 at 7:32am<br /><br />Ahh I see, that makes sense.&nbsp; Thanks!]]>
   </description>
   <pubDate>Tue, 21 Dec 2010 07:32:29 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2382&amp;PID=9445#9445</guid>
  </item> 
  <item>
   <title>Custom Coroutine Operation : The WhenCompleted method is actually...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2382&amp;PID=9444#9444</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> 2382<br /><strong>Posted:</strong> 20-Dec-2010 at 6:57pm<br /><br /><P>The WhenCompleted method is actually called by the Coroutine to pass you an action to call when your asynchronous operation completes.&nbsp;&nbsp; You should hold on to that completedAction callback passed into WhenCompleted, and in your SomeMethodCompleted logic just call that action, pasing in the WebServiceOperationCompletedArgs (assuming they implement INotifyCompletedArgs).</P><DIV></DIV>If you're interested, there's a (more complicated) example of a custom Coroutine operation in the Bad Golf example in the cookbook - <a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/Cookbook" target="_blank">http://drc.ideablade.com/xwiki/bin/view/Documentation/Cookbook</A>]]>
   </description>
   <pubDate>Mon, 20 Dec 2010 18:57:04 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2382&amp;PID=9444#9444</guid>
  </item> 
  <item>
   <title>Custom Coroutine Operation : Is there an example on how to...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2382&amp;PID=9422#9422</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> 2382<br /><strong>Posted:</strong> 16-Dec-2010 at 12:06pm<br /><br /><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri>Is there an example on how to write a custom coroutine operation?<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>What I mean is a custom operation that implements INotifyCompleted or inherits from BaseOperation.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>All of the documentation I've found so far shows how to write the producer and consumer, and the producer is always yield returning DevForce operations such as EntityQueryOperation or EntitySaveOperation.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>We're looking to have our coroutine execute a custom web service as one of the operation steps but I'm having trouble determining how to implement INotifyCompleted.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>There's only 1 method to implement.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>It seems fairly clear that the WhenCompleted() method should be called when the web service finishes it's async processing, but who supplies the completedAction?<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Something like this:<?: prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri>private IEnumerable&lt;INotifyCompleted&gt; CoroutineProducer()<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri>{<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>var op1 = em.Customers.Where().ExecuteAsync();<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>yield return op1;<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>var op2 =WebServiceExecutor.ExecuteAsync();<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>yield return op2;<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>var op3 = em.SaveChanges();<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>yield return op3;<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri>}<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri>static public class WebServiceExecutor<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri>{<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>static public WebServiceOperation ExecuteAsync()<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>var op = new WebServiceOperation();<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>op.Start();<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>return op;<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri>}<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri>public class WebServiceOperation : INotifyCompleted<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri>{<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>public void Start()<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>WebServiceClient client = new WebServiceClient();<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>client.SomeMethodCompleted += (completedArgs) =&gt;<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri><SPAN style="mso-tab-count: 3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>WhenCompleted(/* but what Action do I pass? */ null);<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>};<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>client.SomeMethod();<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>public WhenCompleted(Action&lt;INotifyCompletedArgs&gt; completedAction)<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>if (completedAction != null)<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri><SPAN style="mso-tab-count: 3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>completedAction(new WebServiceOperationCompletedArgs());<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri>}<o:p></o:p></FONT></FONT></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><FONT size=3><FONT face=Calibri>I feel like I must be missing something obvious, but I can't seem to connect the dots.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Am I heading about this all wrong?<o:p></o:p></FONT></FONT></P>]]>
   </description>
   <pubDate>Thu, 16 Dec 2010 12:06:16 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2382&amp;PID=9422#9422</guid>
  </item> 
 </channel>
</rss>