<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.0.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>manuelfoerster.net</title>
	<link>http://www.manuelfoerster.net/wordpress</link>
	<description></description>
	<pubDate>Wed, 11 Jul 2007 21:48:36 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.2</generator>
	<language>en</language>
			<item>
		<title>atlas-based workflow designer</title>
		<link>http://www.manuelfoerster.net/wordpress/80/</link>
		<comments>http://www.manuelfoerster.net/wordpress/80/#comments</comments>
		<pubDate>Wed, 13 Sep 2006 12:34:17 +0000</pubDate>
		<dc:creator>manu</dc:creator>
		
	<category>windows workflow foundation</category>
		<guid isPermaLink="false">http://www.manuelfoerster.net/wordpress/80/</guid>
		<description><![CDATA[ finally, jon flanders put his atlas-powered workflow designer online. you can read about it and download it at [1], or have a look at the online demo at [2].
looks like a good point to start from for hosting the designer in a custom web application.
[1] atlas based workflow designer
[2] online demo

]]></description>
			<content:encoded><![CDATA[<p> finally, jon flanders put his atlas-powered workflow designer online. you can read about it and download it at <a href="http://www.masteringbiztalk.com/blogs/jon/PermaLink,guid,5880f478-b448-4c39-9f2e-382d942a7b82.aspx">[1]</a>, or have a look at the online demo at <a href="http://www.masteringbiztalk.com/atlasworkflowdesigner/">[2]</a>.<br />
looks like a good point to start from for hosting the designer in a custom web application.</p>
<p>[1] <a href="http://www.masteringbiztalk.com/blogs/jon/PermaLink,guid,5880f478-b448-4c39-9f2e-382d942a7b82.aspx">atlas based workflow designer</a><br />
[2] <a href="http://www.masteringbiztalk.com/atlasworkflowdesigner/">online demo</a>
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.manuelfoerster.net/wordpress/80/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>cutting edge sudoku</title>
		<link>http://www.manuelfoerster.net/wordpress/74/</link>
		<comments>http://www.manuelfoerster.net/wordpress/74/#comments</comments>
		<pubDate>Thu, 17 Aug 2006 08:34:07 +0000</pubDate>
		<dc:creator>manu</dc:creator>
		
	<category>windows workflow foundation</category>
		<guid isPermaLink="false">http://www.manuelfoerster.net/wordpress/74/</guid>
		<description><![CDATA[ great!
i just noticed Ashish Shetty&#8217;s post about his netfx3-based p2p version of sudoku [1], get it at [2].
his implementation takes advantage of windows communication foundation, windows presentation foundation as well as windows workflow foundation, requiring the june ctp available at [3].
for solving your daily sudoku without the need of installing anything you could also [...]]]></description>
			<content:encoded><![CDATA[<p> great!<br />
i just noticed Ashish Shetty&#8217;s post about his netfx3-based p2p version of sudoku <a href="http://nerddawg.blogspot.com/2006/07/sudoku.html" target="blank">[1]</a>, get it at <a href="http://wpf.netfx3.com/files/folders/applications/entry4714.aspx" target="blank">[2]</a>.<br />
his implementation takes advantage of windows communication foundation, windows presentation foundation as well as windows workflow foundation, requiring the june ctp available at <a href="http://wf.netfx3.com/blogs/news_and_announcements/archive/2006/06/23/June-CTP-Available_2C00_-RC-Build-of-WF.aspx" target="blank">[3]</a>.</p>
<p>for solving your daily sudoku without the need of installing anything you could also point your browser at <a href="http://websudoku.com/" target="blank">[4]</a>.</p>
<p>[1] <a href="http://nerddawg.blogspot.com/2006/07/sudoku.html" target="blank">http://nerddawg.blogspot.com/2006/07/sudoku.html</a><br />
[2] <a href="http://wpf.netfx3.com/files/folders/applications/entry4714.aspx" target="blank">sudoku at netfx3.com</a><br />
[3] <a href="http://wf.netfx3.com/blogs/news_and_announcements/archive/2006/06/23/June-CTP-Available_2C00_-RC-Build-of-WF.aspx" target="blank">netfx3 june ctp</a><br />
[4] <a href="http://websudoku.com/" target="blank">websudoku</a>
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.manuelfoerster.net/wordpress/74/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>two more wwf books in the queue</title>
		<link>http://www.manuelfoerster.net/wordpress/69/</link>
		<comments>http://www.manuelfoerster.net/wordpress/69/#comments</comments>
		<pubDate>Wed, 19 Jul 2006 12:38:06 +0000</pubDate>
		<dc:creator>manu</dc:creator>
		
	<category>windows workflow foundation</category>
		<guid isPermaLink="false">http://www.manuelfoerster.net/wordpress/69/</guid>
		<description><![CDATA[ there are two more books on the windows workflow foundation listed at amazon and waiting to be published:


        (scheduled for october 2006 according to amazon)
	
        (scheduled for november 2006 according to amazon)
        
i&#8217;m [...]]]></description>
			<content:encoded><![CDATA[<p> there are two more books on the windows workflow foundation listed at amazon and waiting to be published:<br />
<a id="more-69"></a><br />
<center><a href="http://www.amazon.de/exec/obidos/redirect?tag=manuelfoerste-21%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.de/gp/redirect.html%253fASIN=1590597184%2526tag=manuelfoerste-21%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/1590597184%25253FSubscriptionId=0EMV44A9A5YT1RVDGZ82" title="View product details at Amazon" target="blank"><img src="http://images.amazon.com/images/P/1590597184.01._SCMZZZZZZZ_.jpg" alt="Foundations of WF. An Introduction to Windows Workflow Foundation" border=0 /></a><br />
        (scheduled for october 2006 according to amazon)</p>
<p>	<a href="http://www.amazon.de/exec/obidos/redirect?tag=manuelfoerste-21%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.de/gp/redirect.html%253fASIN=073562335X%2526tag=manuelfoerste-21%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/073562335X%25253FSubscriptionId=0EMV44A9A5YT1RVDGZ82" title="View product details at Amazon" target="blank"><img src="" alt="Microsoft Windows Workflow Foundation, w. CD-ROM" border=0/></a><br />
        (scheduled for november 2006 according to amazon)<br />
        </center><br />
i&#8217;m sure there will be &#8217;nuff reading matter (at least on the windows workflow foundation) this winter!<br />
<!--kw=wwf book-->
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.manuelfoerster.net/wordpress/69/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>WinFX renamed</title>
		<link>http://www.manuelfoerster.net/wordpress/68/</link>
		<comments>http://www.manuelfoerster.net/wordpress/68/#comments</comments>
		<pubDate>Sat, 17 Jun 2006 13:57:11 +0000</pubDate>
		<dc:creator>manu</dc:creator>
		
	<category>windows workflow foundation</category>
		<guid isPermaLink="false">http://www.manuelfoerster.net/wordpress/68/</guid>
		<description><![CDATA[ As you might have noticed, WinFX recently became .Net 3.0 [1]. They set up a nice community site at [2], this is also where the WF now resides [3].
At [4] you can find a comprehensive overview of blogs related to the WF, aggregating blogs of the WF team members at Microsoft together with community [...]]]></description>
			<content:encoded><![CDATA[<p> As you might have noticed, WinFX recently became .Net 3.0 <a href="http://www.netfx3.com/blogs/news_and_announcements/archive/2006/06/11/Welcome-to-NetFx3.com.aspx" target="_blank">[1]</a>. They set up a nice community site at <a href="http://www.netfx3.com/" target="_blank">[2]</a>, this is also where the WF now resides <a href="http://wf.netfx3.com/" target="_blank">[3]</a>.<br />
At <a href="http://wf.netfx3.com/roller/default.aspx" target="_blank">[4]</a> you can find a comprehensive overview of blogs related to the WF, aggregating blogs of the WF team members at Microsoft together with community blogs. That&#8217;s really great, &#8217;cause now subscribing to one single newsfeed keeps you up to date.<br />
Thanks for the link! <img src='http://www.manuelfoerster.net/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>[1] <a href="http://www.netfx3.com/blogs/news_and_announcements/archive/2006/06/11/Welcome-to-NetFx3.com.aspx" target="_blank">Welcome to NetFx3.com</a><br />
[2] <a href="http://www.netfx3.com/" target="_blank">Microsoft .NET Framework 3.0 Community (NetFx3)</a><br />
[3] <a href="http://wf.netfx3.com/" target="_blank">Windows Workflow Foundation</a><br />
[4] <a href="http://wf.netfx3.com/roller/default.aspx" target="_blank">WF related blogs</a></p>
]]></content:encoded>
			<wfw:commentRSS>http://www.manuelfoerster.net/wordpress/68/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>another WWF book in sight</title>
		<link>http://www.manuelfoerster.net/wordpress/65/</link>
		<comments>http://www.manuelfoerster.net/wordpress/65/#comments</comments>
		<pubDate>Mon, 05 Jun 2006 16:38:59 +0000</pubDate>
		<dc:creator>manu</dc:creator>
		
	<category>windows workflow foundation</category>
		<guid isPermaLink="false">http://www.manuelfoerster.net/wordpress/65/</guid>
		<description><![CDATA[ Todd Kitta [1] just dropped me a note [2], he is working on a book entitled &#8220;Professional Windows Workflow Foundation&#8221;. As he posted [3] on his blog, the book is going to be published by Wrox Press late 2006/early 2007, i&#8217;m sure it is worth waiting for!
And yes, the reflector [4] is definitely one [...]]]></description>
			<content:encoded><![CDATA[<p> Todd Kitta <a href="http://www.kittanet.com/eaiwf">[1]</a> just dropped me a note <a href="http://www.manuelfoerster.net/wordpress/64/#comments">[2]</a>, he is working on a book entitled &#8220;Professional Windows Workflow Foundation&#8221;. As he posted <a href="http://www.kittanet.com/eaiwf/archives/2006/06/professional_wi.html">[3]</a> on his blog, the book is going to be published by Wrox Press late 2006/early 2007, i&#8217;m sure it is worth waiting for!</p>
<p>And yes, the reflector <a href="http://www.aisto.com/roeder/dotnet/">[4]</a> is definitely one of the most important tools when working with the wwf by now. <img src='http://www.manuelfoerster.net/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>[1] <a href="http://www.kittanet.com/eaiwf">Todd Kitta&#8217;s Integration and Workflow Blog</a><br />
[2] <a href="http://www.manuelfoerster.net/wordpress/64/#comments">http://www.manuelfoerster.net/wordpress/64/#comments</a><br />
[3] <a href="http://www.kittanet.com/eaiwf/archives/2006/06/professional_wi.html">Professional Windows Workflow Foundation</a><br />
[4] <a href="http://www.aisto.com/roeder/dotnet/">Reflector for .NET</a></p>
]]></content:encoded>
			<wfw:commentRSS>http://www.manuelfoerster.net/wordpress/65/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>essential windows workflow foundation</title>
		<link>http://www.manuelfoerster.net/wordpress/64/</link>
		<comments>http://www.manuelfoerster.net/wordpress/64/#comments</comments>
		<pubDate>Sat, 03 Jun 2006 09:26:55 +0000</pubDate>
		<dc:creator>manu</dc:creator>
		
	<category>windows workflow foundation</category>
		<guid isPermaLink="false">http://www.manuelfoerster.net/wordpress/64/</guid>
		<description><![CDATA[ really lookin&#8217; forward to dharma shukla&#8217;s [1] book &#8220;essential windows workflow foundation&#8221;. as the last book on the wwf [2] (still the only one available) is kind of deprecated (only covers beta 1) and not at all in-depth (which it wasn&#8217;t meant to be, so i&#8217;m not complaining  ), i think it&#8217;s time [...]]]></description>
			<content:encoded><![CDATA[<p> really lookin&#8217; forward to dharma shukla&#8217;s <a href="http://www.dharmashukla.com/">[1]</a> book &#8220;essential windows workflow foundation&#8221;. as the last book on the wwf <a href="http://www.samspublishing.com/title/0672328488">[2]</a> (still the only one available) is kind of deprecated (only covers beta 1) and not at all in-depth (which it wasn&#8217;t meant to be, so i&#8217;m not complaining <img src='http://www.manuelfoerster.net/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> ), i think it&#8217;s time to release a new one.</p>
<p> [1] <a href="http://www.dharmashukla.com/">http://www.dharmashukla.com/</a> <br />
 [2]<a href="http://www.samspublishing.com/title/0672328488">http://www.samspublishing.com/title/0672328488</a></p>
]]></content:encoded>
			<wfw:commentRSS>http://www.manuelfoerster.net/wordpress/64/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>custom activity libraries - compile time validation issue</title>
		<link>http://www.manuelfoerster.net/wordpress/46/</link>
		<comments>http://www.manuelfoerster.net/wordpress/46/#comments</comments>
		<pubDate>Mon, 24 Apr 2006 20:40:07 +0000</pubDate>
		<dc:creator>manu</dc:creator>
		
	<category>windows workflow foundation</category>
		<guid isPermaLink="false">http://www.manuelfoerster.net/wordpress/46/</guid>
		<description><![CDATA[validation fails at compile time in beta 2]]></description>
			<content:encoded><![CDATA[<p> there is a quite annoying problem with custom activity libraries in beta 2 of the windows workflow foundation.<br />
compiling activity libraries with <em>ActivityValidator</em>s yields errors like <em>Activity &#8216;foo&#8217; validation failed: Property &#8216;bar&#8217; is not set.</em><br />
<a id="more-46"></a><br />
according to [1], beta 1 only ran the validators if the activity was part of a workflow. now beta 2 also runs the validators at compile time, which obviously can&#8217;t work for properties you just don&#8217;t know how to set before design time.<br />
now you can either see if the activity is actually used in a workflow by simply checking it for a parent before validation:</p>
<div class="codesnip-container" >
<div class="codesnip"><span class="kw1">if</span> <span class="br0">&#40;</span>activity.<span class="me1">Parent</span> == <span class="kw1">null</span><span class="br0">&#41;</span><br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span class="kw3">new</span></a> ValidationErrorCollection<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span><br />
<span class="co1">//validation goes here&#8230; </span></div>
</div>
<p>or you make your library an ordinary c# project by removing the</p>
<div class="codesnip-container" >import Project=&#8221;$(MSBuildExtensionsPath)\Microsoft\Windows Workflow Foundation\v3.0\Workflow.Targets&#8221;</div>
<p>tag from your library&#8217;s build file.</p>
<p>[1] <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=238295&#038;SiteID=1">msdn wwf forum</a>
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.manuelfoerster.net/wordpress/46/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Custom WorkflowPersistenceServices</title>
		<link>http://www.manuelfoerster.net/wordpress/40/</link>
		<comments>http://www.manuelfoerster.net/wordpress/40/#comments</comments>
		<pubDate>Thu, 09 Mar 2006 23:38:03 +0000</pubDate>
		<dc:creator>manu</dc:creator>
		
	<category>windows workflow foundation</category>
		<guid isPermaLink="false">http://www.manuelfoerster.net/wordpress/40/</guid>
		<description><![CDATA[WWF Beta 2 comes along with a SqlWorkflowPersistenceService for persisting the state of longrunning workflows. As this service only works with Microsoft SQL Server or the Express Edition, you might think about creating your own persistence service which could target any other storage medium, like other relational databases, files, or - in this case - datasets.]]></description>
			<content:encoded><![CDATA[<p> WWF Beta 2 comes along with a SqlWorkflowPersistenceService for persisting the state of longrunning workflows. As this service only works with Microsoft SQL Server or the Express Edition, you might think about creating your own persistence service which could target any other storage medium, like other relational databases, files, or - in this case - datasets.<br />
<a id="more-40"></a><br />
For a short introduction to the WWF persistence services see [1], a comprehensive overview of a workflow&#8217;s lifecycle (and the persistence points) is described in [2].</p>
<p>As a first simple approach, i tried storing the workflows in a dataset with one table, which consits of the following columns:</p>
<div class="codesnip-container" >
<div class="codesnip">Blocked : boolean<br />
Info : <span class="kw4">string</span><br />
InstanceID : Guid<br />
DateTime : DateTime<br />
Activities : <span class="kw4">byte</span><span class="br0">&#91;</span><span class="br0">&#93;</span><br />
StateID : Guid<br />
Status : <span class="kw4">int</span><br />
Type : <span class="kw4">int</span> <br />
Unlocked : boolean</div>
</div>
<p>To implement a custom persistence service for your workflows, you just have to inherit from WorkflowPersistenceService (in System.Workflow.Hosting) and override the following methods:</p>
<div class="codesnip-container" >
<div class="codesnip"><span class="kw1">protected</span> <span class="kw1">override</span> <span class="kw1">void</span> SaveWorkflowInstanceState<span class="br0">&#40;</span>Activity rootActivity, <span class="kw4">bool</span> unlock<span class="br0">&#41;</span>;<br />
<span class="kw1">protected</span> <span class="kw1">override</span> Activity LoadWorkflowInstanceState<span class="br0">&#40;</span>Guid instanceId<span class="br0">&#41;</span>;<br />
<span class="kw1">protected</span> <span class="kw1">override</span> <span class="kw1">void</span> UnlockWorkflowInstanceState<span class="br0">&#40;</span>Activity state<span class="br0">&#41;</span>;<br />
<span class="kw1">protected</span> <span class="kw1">override</span> <span class="kw1">void</span> SaveCompletedContextActivity<span class="br0">&#40;</span>Activity rootActivity<span class="br0">&#41;</span>;<br />
<span class="kw1">protected</span> <span class="kw1">override</span> Activity LoadCompletedContextActivity<span class="br0">&#40;</span>Guid activityId, Activity outerActivity<span class="br0">&#41;</span>;<br />
<span class="kw1">protected</span> <span class="kw1">override</span> <span class="kw4">bool</span> UnloadOnIdle<span class="br0">&#40;</span>Activity activity<span class="br0">&#41;</span>;</div>
</div>
<p>where SaveWorkflowInstanceState, LoadWorkflowInstanceState, SaveCompletedContextActivity and LoadCompletedContextActivity are the important ones to fill in.</p>
<p>There are two main methods for serialization and deserialization:</p>
<div class="codesnip-container" >
<div class="codesnip"><span class="kw1">private</span> <span class="kw1">void</span> SerializeActivity<span class="br0">&#40;</span>Activity rootActivity, Guid id<span class="br0">&#41;</span><br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>rootActivity == <span class="kw1">null</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">throw</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span class="kw3">new</span></a> ArgumentNullException<span class="br0">&#40;</span><span class="st0">&#8220;rootActivity&#8221;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; PersistentWorkflow pwf = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span class="kw3">new</span></a> PersistentWorkflow<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; PersistentWorkflow.<span class="me1">WorkflowInstanceRow</span> newRow = pwf.<span class="me1">WorkflowInstance</span>.<span class="me1">NewWorkflowInstanceRow</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</p>
<p>&nbsp; &nbsp; WorkflowStatus status = <span class="br0">&#40;</span>WorkflowStatus<span class="br0">&#41;</span> rootActivity.<span class="me1">GetValue</span><span class="br0">&#40;</span>WorkflowInstance.<span class="me1">WorkflowStatusProperty</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="kw4">bool</span> blocked = <span class="br0">&#40;</span><span class="kw4">bool</span><span class="br0">&#41;</span> rootActivity.<span class="me1">GetValue</span><span class="br0">&#40;</span>WorkflowInstance.<span class="me1">IsBlockedProperty</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="kw4">string</span> info = <span class="br0">&#40;</span><span class="kw4">string</span><span class="br0">&#41;</span> rootActivity.<span class="me1">GetValue</span><span class="br0">&#40;</span>WorkflowInstance.<span class="me1">SuspendOrTerminateInfoProperty</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; Guid guid = <span class="br0">&#40;</span>Guid<span class="br0">&#41;</span>rootActivity.<span class="me1">GetValue</span><span class="br0">&#40;</span>Activity.<span class="me1">ActivityContextGuidProperty</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; newRow.<span class="me1">InstanceID</span> = <span class="br0">&#40;</span>Guid<span class="br0">&#41;</span> rootActivity.<span class="me1">GetValue</span><span class="br0">&#40;</span>WorkflowInstance.<span class="me1">WorkflowInstanceIdProperty</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#40;</span>status != WorkflowStatus.<span class="me1">Completed</span><span class="br0">&#41;</span> &amp;&amp; <span class="br0">&#40;</span>status != WorkflowStatus.<span class="me1">Terminated</span><span class="br0">&#41;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; newRow.<span class="me1">Activities</span> = WorkflowPersistenceService.<span class="me1">GetDefaultSerializedForm</span><span class="br0">&#40;</span>rootActivity<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="kw1">else</span><br />
&nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; newRow.<span class="me1">Activities</span> = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span class="kw3">new</span></a> <span class="kw4">byte</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; newRow.<span class="me1">Status</span> = <span class="br0">&#40;</span><span class="kw4">int</span><span class="br0">&#41;</span> status;<br />
&nbsp; &nbsp; newRow.<span class="me1">Blocked</span> = blocked;<br />
&nbsp; &nbsp; newRow.<span class="me1">Info</span> = info;<br />
&nbsp; &nbsp; newRow.<span class="me1">StateID</span> = guid;<br />
&nbsp; &nbsp; newRow.<span class="me1">Unlocked</span> = <span class="kw1">true</span>;<br />
&nbsp; &nbsp; TimerEventSubscriptionCollection collection1 = <span class="br0">&#40;</span>TimerEventSubscriptionCollection<span class="br0">&#41;</span> rootActivity.<span class="me1">GetValue</span><span class="br0">&#40;</span>WorkflowInstance.<span class="me1">TimerCollectionProperty</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; TimerEventSubscription subscription1 = collection1.<span class="me1">Peek</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; newRow.<span class="me1">DateTime</span> = <span class="br0">&#40;</span>subscription1 == <span class="kw1">null</span><span class="br0">&#41;</span> ? DateTime.<span class="me1">MaxValue</span> : <span class="br0">&#40;</span><span class="br0">&#40;</span>DateTime<span class="br0">&#41;</span> subscription1.<span class="me1">ExpiresAt</span><span class="br0">&#41;</span>;</p>
<p>&nbsp; &nbsp; pwf.<span class="me1">WorkflowInstance</span>.<span class="me1">AddWorkflowInstanceRow</span><span class="br0">&#40;</span>newRow<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="kw4">string</span> filename = FBaseDir + <span class="st0">&#8220;<span class="es0">\\</span>&#8220;</span> + id.<span class="me1">ToString</span><span class="br0">&#40;</span><span class="br0">&#41;</span> + <span class="st0">&#8220;.xml&#8221;</span>;<br />
&nbsp; &nbsp; pwf.<span class="me1">WriteXml</span><span class="br0">&#40;</span>filename<span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span></p>
<p><span class="kw1">private</span> <span class="kw4">object</span> DeserializeActivity<span class="br0">&#40;</span>Activity RootActivity, Guid id<span class="br0">&#41;</span><br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="kw4">string</span> filename = FBaseDir + <span class="st0">&#8220;<span class="es0">\\</span>&#8220;</span> + id.<span class="me1">ToString</span><span class="br0">&#40;</span><span class="br0">&#41;</span> + <span class="st0">&#8220;.xml&#8221;</span>;<br />
&nbsp; &nbsp; PersistentWorkflow pwf = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span class="kw3">new</span></a> PersistentWorkflow<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; pwf.<span class="me1">ReadXml</span><span class="br0">&#40;</span>filename<span class="br0">&#41;</span>;</p>
<p>&nbsp; &nbsp; <span class="kw4">byte</span><span class="br0">&#91;</span><span class="br0">&#93;</span> instanceState = <span class="br0">&#40;</span><span class="br0">&#40;</span>PersistentWorkflow.<span class="me1">WorkflowInstanceRow</span><span class="br0">&#41;</span>pwf.<span class="me1">WorkflowInstance</span>.<span class="me1">Rows</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="br0">&#41;</span>.<span class="me1">Activities</span>;</p>
<p>&nbsp; &nbsp; Activity result = RestoreFromDefaultSerializedForm<span class="br0">&#40;</span>instanceState, <span class="kw1">null</span><span class="br0">&#41;</span> ;</p>
<p>&nbsp; &nbsp; <span class="kw1">return</span> result;<br />
<span class="br0">&#125;</span></div>
</div>
<p>As you can see, deserializing the workflow instance is just calling one method (coming with the baseclass) on the activities entry of the dataset.<br />
Now you might wonder why the other information is persisted when serializing: you will need when managing long running workflows whose lifetime exceeds that of the application&#8217;s instance, maybe i will cover that one in another post.</p>
<p>Invoking the (de)serialization is done in the four load and save methods you have to override:</p>
<div class="codesnip-container" >
<div class="codesnip"><span class="kw1">protected</span> <span class="kw1">override</span> <span class="kw1">void</span> SaveWorkflowInstanceState<span class="br0">&#40;</span>Activity rootActivity, <span class="kw4">bool</span> unlock<span class="br0">&#41;</span><br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; SerializeActivity<span class="br0">&#40;</span>rootActivity, <span class="br0">&#40;</span>Guid<span class="br0">&#41;</span>rootActivity.<span class="me1">GetValue</span><span class="br0">&#40;</span>Activity.<span class="me1">ActivityContextGuidProperty</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span></p>
<p><span class="kw1">protected</span> <span class="kw1">override</span> Activity LoadWorkflowInstanceState<span class="br0">&#40;</span>Guid instanceId<span class="br0">&#41;</span><br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="kw4">object</span> obj = DeserializeActivity<span class="br0">&#40;</span><span class="kw1">null</span>, instanceId<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="kw1">return</span> <span class="br0">&#40;</span>Activity<span class="br0">&#41;</span>obj;<br />
<span class="br0">&#125;</span></p>
<p><span class="kw1">protected</span> <span class="kw1">override</span> <span class="kw1">void</span> SaveCompletedContextActivity<span class="br0">&#40;</span>Activity rootActivity<span class="br0">&#41;</span><br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; ActivityExecutionContext contextInfo = <span class="br0">&#40;</span>ActivityExecutionContext<span class="br0">&#41;</span>rootActivity.<span class="me1">GetValue</span><span class="br0">&#40;</span>Activity.<span class="me1">ActivityContextGuidProperty</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; SerializeActivity<span class="br0">&#40;</span>rootActivity, contextInfo.<span class="me1">ContextGuid</span><span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span></p>
<p><span class="kw1">protected</span> <span class="kw1">override</span> Activity LoadCompletedContextActivity<span class="br0">&#40;</span>Guid activityId, Activity outerActivity<span class="br0">&#41;</span><br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="kw4">object</span> obj = DeserializeActivity<span class="br0">&#40;</span>outerActivity, activityId<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="kw1">return</span> <span class="br0">&#40;</span>Activity<span class="br0">&#41;</span>obj;<br />
<span class="br0">&#125;</span></div>
</div>
<p>So, the framework does the main part of the work, with GetDefaultSerializedForm and RestoreFromDefaultSerializedForm from the WorkflowPersistenceService baseclass. </p>
<p>For using this service in your application, you just have to add the persistence service to your workflow runtime:</p>
<div class="codesnip-container" >
<div class="codesnip">workflowRuntime.<span class="me1">AddService</span><span class="br0">&#40;</span><a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span class="kw3">new</span></a> DatasetPersistenceService<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</div>
<p>Comments appreciated, but keep in mind that this one was just a first quick and dirty approach, so be gentle. <img src='http://www.manuelfoerster.net/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>[1] <a href="http://weblogs.asp.net/gsusx/archive/2005/10/05/426699.aspx">Window Workflow Foundation Runtime Services: The Persistence Service</a><br />
[2] <a href="http://blogs.msdn.com/moustafa/archive/2006/03/02/542459.aspx">Managing Workflow&#8217;s Lifecycle</a>
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.manuelfoerster.net/wordpress/40/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>rule driven workflows</title>
		<link>http://www.manuelfoerster.net/wordpress/41/</link>
		<comments>http://www.manuelfoerster.net/wordpress/41/#comments</comments>
		<pubDate>Mon, 06 Mar 2006 21:26:13 +0000</pubDate>
		<dc:creator>manu</dc:creator>
		
	<category>windows workflow foundation</category>
		<guid isPermaLink="false">http://www.manuelfoerster.net/wordpress/41/</guid>
		<description><![CDATA[rule driven workflows in the windows workflow foundation]]></description>
			<content:encoded><![CDATA[<p> with the rules capability in the windows workflow foundation [1], parts of business and application logic can be represented by more (policies) or less (conditioned activities) complex rulesets. the most important advantage is, that you can load and update those rulesets dynamically at runtime. e.g., validation logic, calculation, etc. could be sourced out of the application.</p>
<p>to get in touch with the rules engine, read the comprehensive introductory article at [2] and have a look at the corresponding hands on lab [3].<br />
[4] shows how to host the ruleset designer in a custom application, for defining and modifying rules at runtime.</p>
<p>[1] <a href="http://www.windowsworkflow.net" target="_blank">windows workflow foundation</a><br />
[2] <a href="http://msdn.microsoft.com/windowsvista/default.aspx?pull=/library/en-us/dnlong/html/intWF_FndRlsEng.asp" target="_blank">Introduction to the Windows Workflow Foundation Rules Engine</a><br />
[3] <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=5DF74E3B-FB51-4A94-A11D-DFF70288A8BB&#038;displaylang=en" target="_blank">WWF Beta 2 Hands on Labs</a><br />
[4] <a href="http://www.windowsworkflow.net/default.aspx?tabindex=4&#038;tabid=49">external ruleset toolkit</a>
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.manuelfoerster.net/wordpress/41/feed/</wfw:commentRSS>
		</item>
	</channel>
</rss>
