<?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 : AsyncSerialTask, preferred way to stop execution</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : AsyncSerialTask, preferred way to stop execution</description>
  <pubDate>Sun, 12 Apr 2026 14:40:29 -700</pubDate>
  <lastBuildDate>Mon, 01 Nov 2010 15:21:44 -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=2276</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>AsyncSerialTask, preferred way to stop execution : Nothing is really stopping us...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2276&amp;PID=8999#8999</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> 2276<br /><strong>Posted:</strong> 01-Nov-2010 at 3:21pm<br /><br />Nothing is really stopping us from upgrading, it's really just a matter of timing.&nbsp; I'll likely be the one doing the upgrade and have a few things that are higher priority at the moment.&nbsp; Thanks again!]]>
   </description>
   <pubDate>Mon, 01 Nov 2010 15:21:44 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2276&amp;PID=8999#8999</guid>
  </item> 
  <item>
   <title>AsyncSerialTask, preferred way to stop execution : Sorry ... the Continue flag was...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2276&amp;PID=8996#8996</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=482" rel="nofollow">WardBell</a><br /><strong>Subject:</strong> 2276<br /><strong>Posted:</strong> 01-Nov-2010 at 1:16pm<br /><br />Sorry ... the Continue flag was added after 6.0.4. <DIV></DIV>I wish there had been a Cancel command exactly as you suggest. I would move to add it ... except the entire class is deprecated.<DIV><BR>What stops you from upgrading? I'm always curious about that :-&gt;</DIV>]]>
   </description>
   <pubDate>Mon, 01 Nov 2010 13:16:17 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2276&amp;PID=8996#8996</guid>
  </item> 
  <item>
   <title>AsyncSerialTask, preferred way to stop execution : Thanks Ward.  We&amp;#039;re still...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2276&amp;PID=8994#8994</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> 2276<br /><strong>Posted:</strong> 01-Nov-2010 at 8:41am<br /><br />Thanks Ward.<DIV>&nbsp;</DIV><DIV>We're still using version 6.0.4 at the moment, hopefully I'll manage some time to update to 6.0.6 soon, but for the time being we'll&nbsp;be&nbsp;using the AsyncSerialTask.</DIV><DIV>&nbsp;</DIV><DIV>I didn't see a Continue flag in the AsyncSerialTaskExceptionArgs, and the compiler doesn't seem to know what a AsyncSerialTaskException is&nbsp;(assuming that I would need to cast the AsyncSerialTaskExceptionArgs.Exception to a AsyncSerialTaskException). &nbsp;The only thing I could find was the Handled flag in the AsyncSerialTaskExceptionArgs, which is initially set to false but can be set to true, and if I'm reading the documenation correctly does the exact opposite of what I need to do.&nbsp; To restate it, this does: When an exception occurs, and the exception handler handles the exception properly, go ahead and continue&nbsp;executing the task.&nbsp; Whereas what I was looking for is:&nbsp; I need a way to cancel the execution of the task when I determine that there is a problem, but would prefer not to throw an exception.</DIV><DIV>&nbsp;</DIV><DIV>From above:</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .AddAction((b) =&gt;<?: PREFIX = O /><O:P></O:P><P style="MARGIN: 0.75pt 1.5pt" ="Ms&#111;normal"><SPAN style="FONT-FAMILY: 'Verdana', 'sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp;&nbsp;&nbsp; {<O:P></O:P></SPAN></P><P style="MARGIN: 0.75pt 1.5pt" ="Ms&#111;normal"><SPAN style="FONT-FAMILY: 'Verdana', 'sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (b.HasError)<O:P></O:P></SPAN></P><P style="MARGIN: 0.75pt 1.5pt" ="Ms&#111;normal"><SPAN style="FONT-FAMILY: 'Verdana', 'sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw b.Error;<O:P></O:P></SPAN></P><P style="MARGIN: 0.75pt 1.5pt" ="Ms&#111;normal"><SPAN style="FONT-FAMILY: 'Verdana', 'sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;<O:P></O:P></SPAN></P><P style="MARGIN: 0.75pt 1.5pt" ="Ms&#111;normal"><SPAN style="FONT-FAMILY: 'Verdana', 'sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Results indicate an entity with the same name already exists in the database.<O:P></O:P></SPAN></P><P style="MARGIN: 0.75pt 1.5pt" ="Ms&#111;normal"><SPAN style="FONT-FAMILY: 'Verdana', 'sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (a.Results.Count() &gt; 0)<O:P></O:P></SPAN></P><P style="MARGIN: 0.75pt 1.5pt" ="Ms&#111;normal"><SPAN style="FONT-FAMILY: 'Verdana', 'sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw new Exception("Name is not unique");<O:P></O:P></SPAN></P><P style="MARGIN: 0.75pt 1.5pt" ="Ms&#111;normal"><SPAN style="FONT-FAMILY: 'Verdana', 'sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp;&nbsp;&nbsp; }</P><DIV></SPAN>&nbsp;</DIV><DIV>Looking for something like:</DIV><DIV>var task = AsyncSerialTask.Create()</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .*</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .AddAction((b) =&gt;<O:P></O:P></DIV></DIV><DIV><P style="MARGIN: 0.75pt 1.5pt" ="Ms&#111;normal"><SPAN style="FONT-FAMILY: 'Verdana', 'sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp;&nbsp;&nbsp; {</P><DIV><P style="MARGIN: 0.75pt 1.5pt" ="Ms&#111;normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Throw here, because this actually is an Exception.<O:P></O:P></SPAN></P><SPAN style="FONT-FAMILY: 'Verdana', 'sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (b.HasError)<O:P></O:P></SPAN></DIV><P style="MARGIN: 0.75pt 1.5pt" ="Ms&#111;normal"><SPAN style="FONT-FAMILY: 'Verdana', 'sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw b.Error;</P><DIV></SPAN><SPAN style="FONT-FAMILY: 'Verdana', 'sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN></SPAN>&nbsp;</DIV><DIV><SPAN style="FONT-FAMILY: 'Verdana', 'sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Don't throw here, this isn't really an exception, but is a reason to stop processing.</SPAN></DIV><DIV><SPAN style="FONT-FAMILY: 'Verdana', 'sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (b.Results.Count() &gt; 0)</SPAN></DIV><DIV><SPAN style="FONT-FAMILY: 'Verdana', 'sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</SPAN></DIV><DIV><SPAN style="FONT-FAMILY: 'Verdana', 'sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // throw new Exception("Name is not unique");<O:P></O:P><O:P></O:P></SPAN></DIV><P style="MARGIN: 0.75pt 1.5pt" ="Ms&#111;normal"><SPAN style="FONT-FAMILY: 'Verdana', 'sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; task.CancelExecution();</P><DIV></SPAN><SPAN style="FONT-FAMILY: 'Verdana', 'sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</SPAN></DIV><DIV><SPAN style="FONT-FAMILY: 'Verdana', 'sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</SPAN></DIV><DIV><SPAN style="FONT-FAMILY: 'Verdana', 'sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN></SPAN>&nbsp;</DIV><DIV><SPAN style="FONT-FAMILY: 'Verdana', 'sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN><O:P>Again, not really a big issue, was just wondering if there was a preferred method of stopping processing of the remaining actions in a task,&nbsp;but it's&nbsp;looking to me like there's nothing 'built-in'.&nbsp; It may all be moot anyway if 6.0.6 has something differernt/better in place for handling async tasks serially.<DIV>&nbsp;</DIV><DIV><DIV></DIV><DIV></DIV>Thanks!</DIV><DIV></DIV>Ken</O:P></SPAN></DIV></DIV>]]>
   </description>
   <pubDate>Mon, 01 Nov 2010 08:41:19 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2276&amp;PID=8994#8994</guid>
  </item> 
  <item>
   <title>AsyncSerialTask, preferred way to stop execution : Hi Ken.   First, thanks for...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2276&amp;PID=8988#8988</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=482" rel="nofollow">WardBell</a><br /><strong>Subject:</strong> 2276<br /><strong>Posted:</strong> 29-Oct-2010 at 3:09pm<br /><br />Hi Ken. <DIV>&nbsp;</DIV><DIV>First, thanks for making such good use of the AsyncSerialTask. That is probably the hardest component to use in DevForce. As of DF 6.0.6 we are encouraging folks to use the Coroutine instead. See the<a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/Coroutines" target="_blank"> DRC article on Coroutines</A>. Works only for C# developers, btw.</DIV><DIV>&nbsp;</DIV><DIV>We're all looking forward to the "async" and "await" keywords that were announced for C#5 and VB11 at PDC 2010.</DIV><DIV>&nbsp;</DIV><DIV>Meanwhile, I believe you can short-circuit processing of task by setting the&nbsp;Continue flag to false in the&nbsp;AsyncSerialTaskException arg that arrives in your exception handler (the lambda that shows the MessageBox in your example). See <B><U><FONT color=#0066cc><FONT color=#0066cc><FONT size=2>IdeaBlade.EntityModel</FONT></B></U></FONT></FONT><FONT size=2>.<FONT color=#0066cc><FONT color=#0066cc><strong><U>AsyncSerialTaskExceptionArgs</U></strong></FONT></FONT><FONT color=#000000>.</FONT></FONT></DIV><DIV><FONT size=2></FONT>&nbsp;</DIV><DIV><FONT size=2>Hope that does it for you.</FONT></DIV>]]>
   </description>
   <pubDate>Fri, 29 Oct 2010 15:09:19 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2276&amp;PID=8988#8988</guid>
  </item> 
  <item>
   <title>AsyncSerialTask, preferred way to stop execution : We&amp;#039;ve been using AsyncSerialTask...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2276&amp;PID=8978#8978</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> 2276<br /><strong>Posted:</strong> 29-Oct-2010 at 10:38am<br /><br /><P style="MARGIN: 0in 1.5pt 0.75pt" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>We've been using AsyncSerialTask for quite a while now, but what has never been clear to me is how to stop the task prematurely when a problem occurs.&nbsp; Consider the following pseudo-code: <?: prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P><P style="MARGIN: 0.75pt 1.5pt" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;<o:p></o:p></SPAN></P><P style="MARGIN: 0.75pt 1.5pt" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>AsyncSerialTask.Create()<o:p></o:p></SPAN></P><P style="MARGIN: 0.75pt 1.5pt" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp;&nbsp;&nbsp; .AddExceptionHandler((x) =&gt;<o:p></o:p></SPAN></P><P style="MARGIN: 0.75pt 1.5pt" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp;&nbsp;&nbsp; {<o:p></o:p></SPAN></P><P style="MARGIN: 0.75pt 1.5pt" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MessageBox.Show(x.Exception);<o:p></o:p></SPAN></P><P style="MARGIN: 0.75pt 1.5pt" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp;&nbsp;&nbsp; }<o:p></o:p></SPAN></P><P style="MARGIN: 0.75pt 1.5pt" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp;&nbsp;&nbsp; .AddAsyncAction((a) =&gt; CheckForDuplicateName(a, nameToCheck))<o:p></o:p></SPAN></P><P style="MARGIN: 0.75pt 1.5pt" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp;&nbsp;&nbsp; .AddAction((b) =&gt;<o:p></o:p></SPAN></P><P style="MARGIN: 0.75pt 1.5pt" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp;&nbsp;&nbsp; {<o:p></o:p></SPAN></P><P style="MARGIN: 0.75pt 1.5pt" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (b.HasError)<o:p></o:p></SPAN></P><P style="MARGIN: 0.75pt 1.5pt" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw b.Error;<o:p></o:p></SPAN></P><P style="MARGIN: 0.75pt 1.5pt" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;<o:p></o:p></SPAN></P><P style="MARGIN: 0.75pt 1.5pt" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Results indicate an entity with the same name already exists in the database.<o:p></o:p></SPAN></P><P style="MARGIN: 0.75pt 1.5pt" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (a.Results.Count() &gt; 0)<o:p></o:p></SPAN></P><P style="MARGIN: 0.75pt 1.5pt" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw new Exception("Name is not unique");<o:p></o:p></SPAN></P><P style="MARGIN: 0.75pt 1.5pt" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp;&nbsp;&nbsp; }<o:p></o:p></SPAN></P><P style="MARGIN: 0.75pt 1.5pt" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp;&nbsp;&nbsp; .AddAsyncAction*<o:p></o:p></SPAN></P><P style="MARGIN: 0.75pt 1.5pt" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp;&nbsp;&nbsp; .AddAction*<o:p></o:p></SPAN></P><P style="MARGIN: 0.75pt 1.5pt" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp;&nbsp;&nbsp; .AddAsyncSave*<o:p></o:p></SPAN></P><P style="MARGIN: 0.75pt 1.5pt" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;&nbsp;&nbsp;&nbsp; .Execute(null, (a) =&gt; { });<o:p></o:p></SPAN></P><P style="MARGIN: 0.75pt 1.5pt" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;<o:p></o:p></SPAN></P><P style="MARGIN: 0.75pt 1.5pt" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>Now, obviously the code in AddAction(b) could probably be done internally to CheckForDuplicateName, but I broke it out for demonstration.&nbsp; We want to stop the task from continuing if the name is a duplicate, so we check the results and throw a new exception, allowing the task ExceptionHandler to handle the problem.&nbsp; This works, but the debugger likes to inform us that the exception is not handled when we do this (even though it is).&nbsp; Optionally&nbsp;we could pass around a task process status in the event args and short circuit things that way too.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Is there another option?<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>What is the preferred way to handle this?<o:p></o:p></SPAN></P><P style="MARGIN: 0.75pt 1.5pt" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;<o:p></o:p></SPAN></P><P style="MARGIN: 0.75pt 1.5pt 0pt" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;<o:p></o:p></SPAN></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>]]>
   </description>
   <pubDate>Fri, 29 Oct 2010 10:38:08 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2276&amp;PID=8978#8978</guid>
  </item> 
 </channel>
</rss>