<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Matt W's Windows Workflow Place</title><link>http://blogs.msdn.com/mwinkle/default.aspx</link><description /><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Introduction to WF Designer Rehosting (Part 2)</title><link>http://blogs.msdn.com/mwinkle/archive/2009/06/17/introduction-to-wf-designer-rehosting-part-2.aspx</link><pubDate>Wed, 17 Jun 2009 17:18:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9769899</guid><dc:creator>mwinkle</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/mwinkle/comments/9769899.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mwinkle/commentrss.aspx?PostID=9769899</wfw:commentRss><description>&lt;p&gt;&lt;em&gt;standard beta disclaimer.&amp;#160; This is written against the beta1 API’s.&amp;#160; If this is 2014, the bits will look different.&amp;#160; When the bits update, I will make sure to have a new post that updates these (or points to SDK samples that do)&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;In yesterday’s post, we went over the core components of the designer.&amp;#160; Let’s now take that and build that rehosts the designer, and then we’ll circle back around and talk about what we did and what comes next.&lt;/p&gt;  &lt;p&gt;Start VS, Create a new project, and select a WPF project&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroductiontoWFDesignerRehostingPart2_F7F5/image_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroductiontoWFDesignerRehostingPart2_F7F5/image_thumb.png" width="553" height="398" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Inside the VS project add references to the System.Activities.* assemblies.&amp;#160; For now, that list looks like&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;System.Activities.dll&lt;/li&gt;    &lt;li&gt;System.Activities.Design.Base.dll&lt;/li&gt;    &lt;li&gt;System.Activities.Design.dll&lt;/li&gt;    &lt;li&gt;System.Activities.Core.Design.dll&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroductiontoWFDesignerRehostingPart2_F7F5/image_4.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroductiontoWFDesignerRehostingPart2_F7F5/image_thumb_1.png" width="355" height="292" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;You might think the list of design assemblies is excessive.&amp;#160; We’ll be collapsing probably into two design assemblies, one with the designer infrastructure and one with the activity designers in subsequent milestones.&lt;/p&gt;  &lt;p&gt;Create some layout in the WPF window to hold the various designer elements.&amp;#160; I usually do a three column grid for toolbox, property grid and designer canvas.&lt;/p&gt;  &lt;p&gt;The XAML for this looks roughly like this:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Window&lt;/span&gt; &lt;span class="attr"&gt;x:Class&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;BlogPostRehosting.Window1&amp;quot;&lt;/span&gt;
        &lt;span class="attr"&gt;xmlns&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;&lt;/span&gt;
        &lt;span class="attr"&gt;xmlns:x&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;&lt;/span&gt;
        &lt;span class="attr"&gt;Title&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Window1&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Height&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;664&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Width&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;831&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Grid&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ColumnDefinition&lt;/span&gt; &lt;span class="attr"&gt;Width&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;1*&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ColumnDefinition&lt;/span&gt; &lt;span class="attr"&gt;Width&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;3*&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ColumnDefinition&lt;/span&gt; &lt;span class="attr"&gt;Width&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;2*&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Grid&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Window&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;Now that we’ve got the layout down, let’s get down to business.&amp;#160; First let’s just get an app that displays the workflow designer and then we will add some other interesting features. We wanted to make it easy to get a canvas onto your host application, and to program against it.&amp;#160; The key type that we use is &lt;a href="http://msdn.microsoft.com/en-us/library/system.activities.design.workflowdesigner(VS.100).aspx"&gt;WorkflowDesigner&lt;/a&gt;, this encapsulates all of the functionality, and operating context, required.&amp;#160; Let’s take a quick look at the type definition &lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;table border="0" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;
    &lt;tr&gt;
      &lt;td width="334"&gt;Name&lt;/td&gt;

      &lt;td width="365"&gt;Description&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td width="334"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.activities.design.workflowdesigner.context(VS.100).aspx"&gt;Context&lt;/a&gt;&lt;/td&gt;

      &lt;td width="365"&gt;Gets or sets an EditingContext object that is a collection of services shared between all elements contained in the designer and used to interact between the host and the designer. Services are published and requested through the EditingContext.&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td width="334"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.activities.design.workflowdesigner.contextmenu(VS.100).aspx"&gt;ContextMenu&lt;/a&gt;&lt;/td&gt;

      &lt;td width="365"&gt;Gets the context menu for this designer.&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td width="334"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.activities.design.workflowdesigner.debugmanagerview(VS.100).aspx"&gt;DebugManagerView&lt;/a&gt;&lt;/td&gt;

      &lt;td width="365"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.activities.design.debug.debuggerservice(VS.100).aspx"&gt;Provides a DebuggerServicethat is used for runtime debugging. &lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td width="334"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.activities.design.workflowdesigner.propertygridfontandcolordata(VS.100).aspx"&gt;PropertyGridFontAndColorData&lt;/a&gt;&lt;/td&gt;

      &lt;td width="365"&gt;Sets the property grid font and color data.&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td width="334"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.activities.design.workflowdesigner.propertyinspectorview(VS.100).aspx"&gt;PropertyInspectorView&lt;/a&gt;&lt;/td&gt;

      &lt;td width="365"&gt;Returns a UI element that allows the user to view and edit properties of the workflow.&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td width="334"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.activities.design.workflowdesigner.text(VS.100).aspx"&gt;Text&lt;/a&gt;&lt;/td&gt;

      &lt;td width="365"&gt;Gets or sets the XAML string representation of the workflow.&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td width="334"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.activities.design.workflowdesigner.view(VS.100).aspx"&gt;View&lt;/a&gt;&lt;/td&gt;

      &lt;td width="365"&gt;Returns a UI element that allows the user to view and edit the workflow visually. &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;&lt;/table&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;The editing context is where we will spend more time in the future, for now the View is probably what’s most interesting, as this is the primary designer canvas.&amp;#160; There are also some useful methods to load and persist the workflow as well. &lt;/p&gt;

&lt;p&gt;Let’s start off real simple, and write some code that will display a basic sequence, and we’ll get more sophisticated as we go along.&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Windows;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Windows.Controls;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Activities.Design;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Activities.Core.Design;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Activities.Statements;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; BlogPostRehosting&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;    &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;    &lt;span class="rem"&gt;/// Interaction logic for Window1.xaml&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;partial&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Window1 : Window&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;    {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; Window1()&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;        {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;            InitializeComponent();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;            LoadWorkflowDesigner();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;        }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; LoadWorkflowDesigner()&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;        {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;            WorkflowDesigner wd = &lt;span class="kwrd"&gt;new&lt;/span&gt; WorkflowDesigner();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;            (&lt;span class="kwrd"&gt;new&lt;/span&gt; DesignerMetadata()).Register();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;            wd.Load(&lt;span class="kwrd"&gt;new&lt;/span&gt; Sequence &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;                            { &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;                                Activities = &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;                                {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;                                    &lt;span class="kwrd"&gt;new&lt;/span&gt; Persist(), &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;                                    &lt;span class="kwrd"&gt;new&lt;/span&gt; WriteLine()&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;                                }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;                            });&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;            Grid.SetColumn(wd.View, 1);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;            grid1.Children.Add(wd.View);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;        }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;    }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;Let’s walk through this line by line:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Line 22, construct the workflow designer&lt;/li&gt;

  &lt;li&gt;Line 23, Call Register on the DesignerMetadata class.&amp;#160; Note that this associates all of the out of the box activities with their out of the box designers.&amp;#160; This is optional as a host may wish to provide custom editors for all or some of the out of box activities, or may not be using the out of box activities.&lt;/li&gt;

  &lt;li&gt;Line 24-31, Call Load, passing in an instance of an object graph to display.&amp;#160; This gives the host some flexibility, as this instance could come from XAML, a database, JSON, user input, etc.&amp;#160; We simply create a basic sequence with two activities&lt;/li&gt;

  &lt;li&gt;Line 32, set the column for the view&lt;/li&gt;

  &lt;li&gt;Line 33, add the view to the display&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This gives us the following application:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroductiontoWFDesignerRehostingPart2_F7F5/image_6.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroductiontoWFDesignerRehostingPart2_F7F5/image_thumb_2.png" width="466" height="389" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Now, that was pretty simple, but we’re also missing some key things, namely, the property grid.&amp;#160; It’s important to note however that this has all of the functionality of the designer (the variables designer, the overview map, etc.&amp;#160; This will react just the same as if you were building the workflow in VS.&amp;#160; &lt;/p&gt;

&lt;p&gt;Let’s add the property grid by adding the following two lines:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;Grid.SetColumn(wd.PropertyInspectorView, 2);
grid1.Children.Add(wd.PropertyInspectorView);&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;This will let us see the property grid (so things get a little more interesting).&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroductiontoWFDesignerRehostingPart2_F7F5/image_8.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroductiontoWFDesignerRehostingPart2_F7F5/image_thumb_3.png" width="381" height="315" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;So, we’re able to display the workflow and interact with it, but we probably also want to have a constrained authoring experience (not just editing), so that comes in the form of the &lt;a href="http://msdn.microsoft.com/en-us/library/system.activities.design.toolboxcontrol(VS.100).aspx"&gt;ToolboxControl&lt;/a&gt;.&amp;#160; For the sake of this blog post, we’ll use this in XAML, but we certainly can code against it imperatively as well.&amp;#160; &lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Window&lt;/span&gt; &lt;span class="attr"&gt;x:Class&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;BlogPostRehosting.Window1&amp;quot;&lt;/span&gt;
        &lt;span class="attr"&gt;xmlns&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;&lt;/span&gt;
        &lt;span class="attr"&gt;xmlns:x&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;&lt;/span&gt;
        &lt;span class="attr"&gt;xmlns:sad&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;clr-namespace:System.Activities.Design;assembly=System.Activities.Design&amp;quot;&lt;/span&gt;
        &lt;span class="attr"&gt;xmlns:sys&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;clr-namespace:System;assembly=mscorlib&amp;quot;&lt;/span&gt;
        &lt;span class="attr"&gt;Title&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Window1&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Height&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;664&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Width&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;831&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Window.Resources&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;sys:String&lt;/span&gt; &lt;span class="attr"&gt;x:Key&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;AssemblyName&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;System.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;sys:String&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Window.Resources&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Grid&lt;/span&gt; &lt;span class="attr"&gt;Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;grid1&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ColumnDefinition&lt;/span&gt; &lt;span class="attr"&gt;Width&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;1*&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ColumnDefinition&lt;/span&gt; &lt;span class="attr"&gt;Width&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;3*&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ColumnDefinition&lt;/span&gt; &lt;span class="attr"&gt;Width&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;2*&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;sad:ToolboxControl&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;sad:ToolboxControl.Categories&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;sad:ToolboxCategoryItemsCollection&lt;/span&gt; &lt;span class="attr"&gt;CategoryName&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Basic&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;sad:ToolboxItemWrapper&lt;/span&gt; &lt;span class="attr"&gt;AssemblyName&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;{StaticResource AssemblyName}&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;ToolName&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;System.Activities.Statements.Sequence&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;sad:ToolboxItemWrapper&lt;/span&gt; &lt;span class="attr"&gt;AssemblyName&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;{StaticResource AssemblyName}&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;ToolName&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;System.Activities.Statements.If&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;sad:ToolboxItemWrapper&lt;/span&gt; &lt;span class="attr"&gt;AssemblyName&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;{StaticResource AssemblyName}&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;ToolName&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;System.Activities.Statements.Parallel&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;sad:ToolboxItemWrapper&lt;/span&gt; &lt;span class="attr"&gt;AssemblyName&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;{StaticResource AssemblyName}&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;ToolName&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;System.Activities.Statements.WriteLine&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;sad:ToolboxItemWrapper&lt;/span&gt; &lt;span class="attr"&gt;AssemblyName&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;{StaticResource AssemblyName}&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;ToolName&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;System.Activities.Statements.Persist&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
                &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;sad:ToolboxCategoryItemsCollection&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;sad:ToolboxControl.Categories&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;sad:ToolboxControl&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Grid&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Window&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;This lets me specify the items I want to allow a user to drop.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroductiontoWFDesignerRehostingPart2_F7F5/image_10.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroductiontoWFDesignerRehostingPart2_F7F5/image_thumb_4.png" width="627" height="522" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;The thing that is interesting to point out here is that we’ve built a full featured, constrained editor (with things like copy paste, undo/redo, etc) with not too much code.&lt;/p&gt;

&lt;p&gt;Next time, we’ll get into to doing some more interesting bits as well to interact with the item being edited, serialize to XAML, and explore the editing context some more.&amp;#160; Let me know what you think!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9769899" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mwinkle/archive/tags/wf/default.aspx">wf</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/vs10/default.aspx">vs10</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/wf4/default.aspx">wf4</category></item><item><title>Introduction to WF Designer Rehosting (Part 1)</title><link>http://blogs.msdn.com/mwinkle/archive/2009/06/17/introduction-to-wf-designer-rehosting-part-1.aspx</link><pubDate>Wed, 17 Jun 2009 00:31:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9763452</guid><dc:creator>mwinkle</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/mwinkle/comments/9763452.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mwinkle/commentrss.aspx?PostID=9763452</wfw:commentRss><description>&lt;p&gt;&lt;em&gt;standard beta disclaimer.&amp;#160; This is written against the beta1 API’s.&amp;#160; If this is 2014, the bits will look different.&amp;#160; When the bits update, I will make sure to have a new post that updates these (or points to SDK samples that do)&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;In WF3, we allowed our customers to rehost the WF designer inside their own applications.&amp;#160; This has many &lt;a href="http://msdn.microsoft.com/en-us/library/cc835242.aspx"&gt;reasons&lt;/a&gt;, usually about monitoring a workflow or allowing an end user to customize a constrained workflow (visual construction of an approval process, for instance). This &lt;a href="http://msdn.microsoft.com/en-us/library/aa480213.aspx"&gt;article&lt;/a&gt; became the gold standard for writing rehosted applications.&amp;#160; As we were planning our work for the WF4 designer, this was certainly a scenario we considered, and one we wanted to make easier.&amp;#160; &lt;/p&gt;  &lt;p&gt;This post consists of a few parts&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Designer architecture – introduce the pieces, parts and terms we’ll use throughout &lt;/li&gt;    &lt;li&gt;Simple rehosting – getting it up and running &lt;/li&gt;    &lt;li&gt;What to do next &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h1&gt;Designer Architecture&lt;/h1&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroductiontoWFDesignerRehosting_ECB0/image_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroductiontoWFDesignerRehosting_ECB0/image_thumb.png" width="639" height="284" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;There are a few key components here&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Source      &lt;ul&gt;       &lt;li&gt;In VS, this is xaml, but this represents the durable storage of the “thing” we are editing &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Instance      &lt;ul&gt;       &lt;li&gt;This is the in memory representation of the item being edited.&amp;#160; In vs2010 for the WF designer, this is a hierarchy of System.Activities instances (an object tree) &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Model Item Tree      &lt;ul&gt;       &lt;li&gt;This serves as an intermediary between the view and the instance, and is responsible for change notification and tracking things like undo state &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Design View      &lt;ul&gt;       &lt;li&gt;This is the visual editing view that is surfaced to the user, the designers are written using WPF, which uses plain old data binding in order to wire up to the underlying model items (which represent the data being edited). &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Metadata Store      &lt;ul&gt;       &lt;li&gt;This is a mapping between type and designers, an attribute table for lack of a better term.&amp;#160; This is how we know what designer to use for what type &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;I’ll go into more detail about these pieces and parts in future posts as well, but this is the mental model of the things I will be talking about as we go through the designer. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Stay tuned, part 2 will come tomorrow!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9763452" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mwinkle/archive/tags/wf/default.aspx">wf</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/vs10/default.aspx">vs10</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/wf4/default.aspx">wf4</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/rehosting/default.aspx">rehosting</category></item><item><title>Types, Metatypes and Bears, Oh my!</title><link>http://blogs.msdn.com/mwinkle/archive/2009/06/10/types-metatypes-and-bears-oh-my.aspx</link><pubDate>Tue, 09 Jun 2009 23:23:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9718703</guid><dc:creator>mwinkle</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/mwinkle/comments/9718703.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mwinkle/commentrss.aspx?PostID=9718703</wfw:commentRss><description>&lt;p&gt;&lt;a title="Polar Bear" href="http://www.flickr.com/photos/21208051@N00/108149173/"&gt;&lt;img border="0" alt="Polar Bear" src="http://static.flickr.com/52/108149173_990037d136.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;image courtesy of flickr user &lt;a href="http://www.flickr.com/photos/chodhound/108149173/in/set-72057594075424977/"&gt;chodhound&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;This post comes about after a little conversation on the &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/wfprerelease/thread/b07e86c6-c000-4e77-bb56-9600ecf03144"&gt;forums&lt;/a&gt; where I was talking about using the xaml stack save and load objects. &lt;/p&gt;  &lt;p&gt;Here’s what I said:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Bob&amp;#160; (it's a little late in Seattle, so I don't have a code editor handy, so there may be some minor errors below),      &lt;br /&gt;If you want to serialize any object graph to xaml, simply look at the XamlServices.Save() api that's in System.Xaml.&amp;#160; I'm sure there are a few SDK samples around that as well.&amp;#160; It takes in a file name to output to, a text writer or a stream, so you get to pick your poison for destination.&amp;#160; Similarly, if you want to get an object graph deserialized from Xaml, you can just use XamlServices.Load() again, with overloads for files, streams, text, xml, and xaml readers.       &lt;br /&gt;To see this API, just do something like&lt;/p&gt;    &lt;pre&gt;Sequence s = new Sequence { Activities = { new Persist(), new Persist() } };
XamlServices.Save(fileNameVar, s);&lt;/pre&gt;

  &lt;p&gt;If you want to read, basically do the reverse. 
    &lt;br /&gt;Save and Load are convinient helper functions to operate on the whole of the doc, there Xaml stack surfaces much more programmability and has a nice node stream style API that lets you plug in while nodes are being read and written. 

    &lt;br /&gt;Now, if you want to deserialize a Xaml file that contains an x:Class directive, you are going to need to do a bit more work (and it depends what you want to serialize to or from).&amp;#160; I'll try to blog about that in the next week or so.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now, I want to take a little bit of time to explain the last part.&lt;/p&gt;

&lt;p&gt;A convenient way to think about XAML is a way to write down objects, really, instances of objects.&amp;#160; That said I am not limited to writing down just instances, I can actually write down type definitions as well.&amp;#160; I do this using the x:Class attribute.&amp;#160; &lt;/p&gt;

&lt;p&gt;Consider the following XAML snippet&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;Activity x:Class=&amp;quot;foo&amp;quot; ...&lt;/pre&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;This is roughly equivalent to the following C#&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; foo : Activity
{
...&lt;/pre&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;Now, “normally” what happens with XAML like this in .xaml files is that it is used in a VS project and it is set up so that there is a build task who has the job of generating a type from that XAML so that you can use that type subsequently in your application.&amp;#160; This works basically the same way for WPF as well as WF. &lt;/p&gt;

&lt;p&gt;However, if you think about trying simply deserialize this, it’s a little confusing what this will actually deserialize to.&amp;#160; This is a type definition, so if you simply try to pass it to XamlServices.Load(), you will encounter an exception:&lt;/p&gt;

&lt;p&gt;&lt;font face="Consolas"&gt;Error System.Xaml.XamlObjectWriterException: No matching constructor found on type System.Activities.Activity. You can use the Arguments or FactoryMethod direct ives to construct this type. ---&amp;gt; System.MissingMethodException: No default constructor found for type System.Activities.Activity. You can use the Arguments or FactoryMethod directives to construct this type. 
    &lt;br /&gt;&amp;#160;&amp;#160; at System.Xaml.Runtime.ClrObjectRuntime.DefaultCtorXamlActivator.EnsureConstructorDelegate(XamlType xamlType) 

    &lt;br /&gt;&amp;#160;&amp;#160; at System.Xaml.Runtime.ClrObjectRuntime.DefaultCtorXamlActivator.CreateInstance(XamlType xamlType) 

    &lt;br /&gt;&amp;#160;&amp;#160; at System.Xaml.Runtime.ClrObjectRuntime.CreateInstanceWithCtor(XamlType xamlType, Object[] args) 

    &lt;br /&gt;&amp;#160;&amp;#160; at System.Xaml.Runtime.ClrObjectRuntime.CreateInstance(XamlType xamlType, Object[] args) 

    &lt;br /&gt;&amp;#160;&amp;#160; --- End of inner exception stack trace ---&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;So, if we want to deserialize that, we need to ask the question first: “Why do we want to deserialize it?”&lt;/p&gt;

&lt;h2&gt;Deserialize to Execute&lt;/h2&gt;

&lt;p&gt;If we want to simply use the activity we’ve created and have it execute, we have a special type, &lt;a href="http://msdn.microsoft.com/en-us/library/system.activities.dynamicactivity(VS.100).aspx"&gt;DynamicActivity&lt;/a&gt;.&amp;#160; DynamicActivity lets you execute the activity, and rather than creating a type for it, will allow you to pass in the arguments in the typical Dictionary&amp;lt;string,object&amp;gt; way that we are used to.&amp;#160; &lt;/p&gt;

&lt;p&gt;Imagine a xaml file, just sitting on disk somewhere that looks like this (a workflow that concats two strings):&amp;#160; &lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p:Activity&lt;/span&gt; &lt;span class="attr"&gt;mc:Ignorable&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;&amp;quot;&lt;/span&gt;
    &lt;span class="attr"&gt;x:Class&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;WorkflowConsoleApplication1.Sequence1&amp;quot;&lt;/span&gt; 
     &lt;span class="attr"&gt;xmlns&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://schemas.microsoft.com/netfx/2009/xaml/activities/design&amp;quot;&lt;/span&gt;
     &lt;span class="attr"&gt;xmlns:__Sequence1&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;clr-namespace:WorkflowConsoleApplication1;&amp;quot;&lt;/span&gt; 
     &lt;span class="attr"&gt;xmlns:mc&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://schemas.openxmlformats.org/markup-compatibility/2006&amp;quot;&lt;/span&gt; 
     &lt;span class="attr"&gt;xmlns:p&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://schemas.microsoft.com/netfx/2009/xaml/activities&amp;quot;&lt;/span&gt; 
     &lt;span class="attr"&gt;xmlns:x&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;x:Members&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;x:Property&lt;/span&gt; &lt;span class="attr"&gt;Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;argument1&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;p:InArgument(x:String)&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;x:Property&lt;/span&gt; &lt;span class="attr"&gt;Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;argument2&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;p:InArgument(x:String)&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;x:Members&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p:Sequence&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p:WriteLine&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;[argument1 + &amp;quot; &amp;quot; + argument2]&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;p:WriteLine&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;p:Sequence&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;p:Activity&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;The code for this is the following:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;object&lt;/span&gt; o = WorkflowXamlServices.Load(File.OpenRead(&lt;span class="str"&gt;&amp;quot;Sequence1.xaml&amp;quot;&lt;/span&gt;));
Console.WriteLine(&lt;span class="str"&gt;&amp;quot;Success {0}&amp;quot;&lt;/span&gt;, o.GetType());
DynamicActivity da = o &lt;span class="kwrd"&gt;as&lt;/span&gt; DynamicActivity;da.Properties.ToList().ForEach(ap =&amp;gt; Console.WriteLine(&lt;span class="str"&gt;&amp;quot;argument: {0}&amp;quot;&lt;/span&gt;, ap.Name));
WorkflowInvoker.Invoke(da, &lt;span class="kwrd"&gt;new&lt;/span&gt; Dictionary&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;, &lt;span class="kwrd"&gt;object&lt;/span&gt;&amp;gt; { { &lt;span class="str"&gt;&amp;quot;argument1&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;foo&amp;quot;&lt;/span&gt; }, { &lt;span class="str"&gt;&amp;quot;argument2&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;bar&amp;quot;&lt;/span&gt; } });&lt;/pre&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;h2&gt;Deserialize to “Design”&lt;/h2&gt;

&lt;p&gt;At design time, we have an even more interesting problem.&amp;#160; Our designer is an instance editor, and, as such, it must always edit an instance of “something”.&amp;#160; In our case, we actually do some work in our design time xaml reader and writer to deserialize into a metatype, an instance of a type whose sole purpose in life is to describe the activity.&amp;#160; In Beta1, this is called &lt;a href="http://msdn.microsoft.com/en-us/library/system.activities.design.xaml.activityschematype(VS.100).aspx"&gt;ActivitySchemaType&lt;/a&gt;.&amp;#160; ActivitySchemaType simply models the type structure of an activity, complete with properties, etc&amp;#160; If you want to construct an instance of an ActivitySchemaType in code, you can, and then you could use the &lt;a href="http://msdn.microsoft.com/en-us/library/system.activities.design.xaml.designtimexamlwriter(VS.100).aspx"&gt;DesignTimeXamlWriter&lt;/a&gt; in order to properly serialize out to an Activity x:class xaml file.&amp;#160; The following code works on an ActivitySchemaType in memory and then serializes it:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;XamlSchemaContext xsc = &lt;span class="kwrd"&gt;new&lt;/span&gt; XamlSchemaContext();
ActivitySchemaType ast = &lt;span class="kwrd"&gt;new&lt;/span&gt; ActivitySchemaType()
{
    Name = &lt;span class="str"&gt;&amp;quot;foo&amp;quot;&lt;/span&gt;,
    Members = 
     {
        &lt;span class="kwrd"&gt;new&lt;/span&gt; Property { Name=&lt;span class="str"&gt;&amp;quot;argument1&amp;quot;&lt;/span&gt;, Type = xsc.GetXamlType(&lt;span class="kwrd"&gt;typeof&lt;/span&gt;(InArgument&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt;)) }

     },
    Body = &lt;span class="kwrd"&gt;new&lt;/span&gt; Sequence { Activities = { &lt;span class="kwrd"&gt;new&lt;/span&gt; Persist(), &lt;span class="kwrd"&gt;new&lt;/span&gt; Persist() } }
};
StringBuilder sb = &lt;span class="kwrd"&gt;new&lt;/span&gt; StringBuilder();

DesignTimeXamlWriter dtxw = &lt;span class="kwrd"&gt;new&lt;/span&gt; DesignTimeXamlWriter(
    &lt;span class="kwrd"&gt;new&lt;/span&gt; StringWriter(sb),
    xsc, &lt;span class="str"&gt;&amp;quot;foo&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;bar.rock&amp;quot;&lt;/span&gt;);

XamlServices.Save(dtxw, ast);
Console.WriteLine(&lt;span class="str"&gt;&amp;quot;you wrote:&amp;quot;&lt;/span&gt;);
ConsoleColor old = Console.ForegroundColor;
Console.ForegroundColor = ConsoleColor.DarkGray;
Console.WriteLine(sb.ToString());
Console.ForegroundColor = old;&lt;/pre&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;This is what the output looks like:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p:Activity&lt;/span&gt; &lt;span class="attr"&gt;mc:Ignorable&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;&amp;quot;&lt;/span&gt;
     &lt;span class="attr"&gt;x:Class&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;foo&amp;quot;&lt;/span&gt; 
     &lt;span class="attr"&gt;xmlns&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://schemas.microsoft.com/netfx/2009/xaml/activities/design&amp;quot;&lt;/span&gt; 
     &lt;span class="attr"&gt;xmlns:__foo&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;clr-namespace:bar.rock;&amp;quot;&lt;/span&gt; 
     &lt;span class="attr"&gt;xmlns:mc&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://schemas.openxmlformats.org/markup-compatibility/2006&amp;quot;&lt;/span&gt; 
     &lt;span class="attr"&gt;xmlns:p&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://schemas.microsoft.com/netfx/2009/xaml/activities&amp;quot;&lt;/span&gt; 
     &lt;span class="attr"&gt;xmlns:x&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;x:Members&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;x:Property&lt;/span&gt; &lt;span class="attr"&gt;Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;argument1&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;p:InArgument(x:String)&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;x:Members&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p:Sequence&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p:Persist&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p:Persist&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;p:Sequence&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;p:Activity&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;If you want to read in from this, you have to do a little bit of trickery with the designer as DesignTimeXamlReader is not a public type in beta1.&amp;#160; &lt;/p&gt;

&lt;pre class="csharpcode"&gt;WorkflowDesigner wd = &lt;span class="kwrd"&gt;new&lt;/span&gt; WorkflowDesigner();
wd.Load(&lt;span class="str"&gt;&amp;quot;Sequence1.xaml&amp;quot;&lt;/span&gt;);
&lt;span class="kwrd"&gt;object&lt;/span&gt; obj = wd.Context.Services.GetService&amp;lt;ModelService&amp;gt;().Root.GetCurrentValue();
Console.WriteLine(&lt;span class="str"&gt;&amp;quot;object read type: {0}&amp;quot;&lt;/span&gt;, obj.GetType());
ActivitySchemaType schemaType = obj &lt;span class="kwrd"&gt;as&lt;/span&gt; ActivitySchemaType;
Console.WriteLine(&lt;span class="str"&gt;&amp;quot;schema type name: {0}&amp;quot;&lt;/span&gt;, schemaType.Name);
schemaType.Members.ToList().ForEach(p =&amp;gt; Console.WriteLine(&lt;span class="str"&gt;&amp;quot;argument: {0}, type: {1}&amp;quot;&lt;/span&gt;, p.Name, p.Type));&lt;/pre&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;That wraps up our tour of the ways to read (and write)&amp;#160; &amp;lt;Activity x:Class xaml&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Here’s the full text of the little program I put together to execute this, also make sure to drop a sequence1.xaml into your execution directory if you want this to not throw :-) &lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;hr /&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Linq;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Text;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Xaml;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Activities.Statements;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Activities;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.IO;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Activities.Design.Xaml;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Windows.Markup;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Xml;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Activities.Design;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Activities.Design.Services;&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; ConsoleApplication2&lt;/pre&gt;

  &lt;pre&gt;{&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;class&lt;/span&gt; Program&lt;/pre&gt;

  &lt;pre&gt;    {&lt;/pre&gt;

  &lt;pre class="alt"&gt;        [STAThread()]&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;

  &lt;pre class="alt"&gt;        {&lt;/pre&gt;

  &lt;pre&gt;            &lt;span class="kwrd"&gt;bool&lt;/span&gt; doStuff = &lt;span class="kwrd"&gt;true&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre class="alt"&gt;            Guid g = Guid.NewGuid();&lt;/pre&gt;

  &lt;pre&gt;            &lt;span class="kwrd"&gt;while&lt;/span&gt; (doStuff)&lt;/pre&gt;

  &lt;pre class="alt"&gt;            {&lt;/pre&gt;

  &lt;pre&gt;                Console.WriteLine();&lt;/pre&gt;

  &lt;pre class="alt"&gt;                Console.WriteLine(&lt;span class="str"&gt;&amp;quot;What do you want to do?&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;                Console.WriteLine(&lt;span class="str"&gt;&amp;quot;    read [x]:class xaml with XamlServices&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;                Console.WriteLine(&lt;span class="str"&gt;&amp;quot;    read x:class xaml with W[o]rkflowXamlServices&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;                Console.WriteLine(&lt;span class="str"&gt;&amp;quot;    [w]rite an ActivitySchemaType&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;                Console.WriteLine(&lt;span class="str"&gt;&amp;quot;    r[e]ad an ActivitySchemaType&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;                Console.WriteLine(&lt;span class="str"&gt;&amp;quot;    [q]uit&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;                Console.WriteLine();&lt;/pre&gt;

  &lt;pre&gt;                &lt;span class="kwrd"&gt;char&lt;/span&gt; c = Console.ReadKey(&lt;span class="kwrd"&gt;true&lt;/span&gt;).KeyChar;&lt;/pre&gt;

  &lt;pre class="alt"&gt;                &lt;span class="kwrd"&gt;switch&lt;/span&gt; (c)&lt;/pre&gt;

  &lt;pre&gt;                {&lt;/pre&gt;

  &lt;pre class="alt"&gt;                    &lt;span class="kwrd"&gt;case&lt;/span&gt; &lt;span class="str"&gt;'w'&lt;/span&gt;:&lt;/pre&gt;

  &lt;pre&gt;                        XamlSchemaContext xsc = &lt;span class="kwrd"&gt;new&lt;/span&gt; XamlSchemaContext();&lt;/pre&gt;

  &lt;pre class="alt"&gt;                        ActivitySchemaType ast = &lt;span class="kwrd"&gt;new&lt;/span&gt; ActivitySchemaType()&lt;/pre&gt;

  &lt;pre&gt;                        {&lt;/pre&gt;

  &lt;pre class="alt"&gt;                            Name = &lt;span class="str"&gt;&amp;quot;foo&amp;quot;&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt;                            Members = &lt;/pre&gt;

  &lt;pre class="alt"&gt;                             {&lt;/pre&gt;

  &lt;pre&gt;                                &lt;span class="kwrd"&gt;new&lt;/span&gt; Property { Name=&lt;span class="str"&gt;&amp;quot;argument1&amp;quot;&lt;/span&gt;, Type = xsc.GetXamlType(&lt;span class="kwrd"&gt;typeof&lt;/span&gt;(InArgument&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt;)) }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;                             },&lt;/pre&gt;

  &lt;pre class="alt"&gt;                            Body = &lt;span class="kwrd"&gt;new&lt;/span&gt; Sequence { Activities = { &lt;span class="kwrd"&gt;new&lt;/span&gt; Persist(), &lt;span class="kwrd"&gt;new&lt;/span&gt; Persist() } }&lt;/pre&gt;

  &lt;pre&gt;                        };&lt;/pre&gt;

  &lt;pre class="alt"&gt;                        StringBuilder sb = &lt;span class="kwrd"&gt;new&lt;/span&gt; StringBuilder();&lt;/pre&gt;

  &lt;pre&gt;                        &lt;/pre&gt;

  &lt;pre class="alt"&gt;                        DesignTimeXamlWriter dtxw = &lt;span class="kwrd"&gt;new&lt;/span&gt; DesignTimeXamlWriter(&lt;/pre&gt;

  &lt;pre&gt;                            &lt;span class="kwrd"&gt;new&lt;/span&gt; StringWriter(sb),&lt;/pre&gt;

  &lt;pre class="alt"&gt;                            xsc, &lt;span class="str"&gt;&amp;quot;foo&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;bar.rock&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;                        &lt;/pre&gt;

  &lt;pre class="alt"&gt;                        XamlServices.Save(dtxw, ast);&lt;/pre&gt;

  &lt;pre&gt;                        Console.WriteLine(&lt;span class="str"&gt;&amp;quot;you wrote:&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;                        ConsoleColor old = Console.ForegroundColor;&lt;/pre&gt;

  &lt;pre&gt;                        Console.ForegroundColor = ConsoleColor.DarkGray;&lt;/pre&gt;

  &lt;pre class="alt"&gt;                        Console.WriteLine(sb.ToString());&lt;/pre&gt;

  &lt;pre&gt;                        Console.ForegroundColor = old;&lt;/pre&gt;

  &lt;pre class="alt"&gt;                        &lt;span class="kwrd"&gt;break&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;                    &lt;span class="kwrd"&gt;case&lt;/span&gt; &lt;span class="str"&gt;'x'&lt;/span&gt;:&lt;/pre&gt;

  &lt;pre&gt;                        &lt;span class="kwrd"&gt;try&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;                        {&lt;/pre&gt;

  &lt;pre&gt;                            &lt;span class="kwrd"&gt;object&lt;/span&gt; o = XamlServices.Load(File.OpenRead(&lt;span class="str"&gt;&amp;quot;Sequence1.xaml&amp;quot;&lt;/span&gt;));&lt;/pre&gt;

  &lt;pre class="alt"&gt;                            Console.WriteLine(&lt;span class="str"&gt;&amp;quot;Success{0}&amp;quot;&lt;/span&gt;, o.GetType());&lt;/pre&gt;

  &lt;pre&gt;                        }&lt;/pre&gt;

  &lt;pre class="alt"&gt;                        &lt;span class="kwrd"&gt;catch&lt;/span&gt; (Exception ex)&lt;/pre&gt;

  &lt;pre&gt;                        {&lt;/pre&gt;

  &lt;pre class="alt"&gt;                            Console.WriteLine(&lt;span class="str"&gt;&amp;quot;Error {0}&amp;quot;&lt;/span&gt;, ex);&lt;/pre&gt;

  &lt;pre&gt;                        }&lt;/pre&gt;

  &lt;pre class="alt"&gt;                        &lt;span class="kwrd"&gt;break&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;                    &lt;span class="kwrd"&gt;case&lt;/span&gt; &lt;span class="str"&gt;'o'&lt;/span&gt;:&lt;/pre&gt;

  &lt;pre class="alt"&gt;                        &lt;span class="kwrd"&gt;try&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;                        {&lt;/pre&gt;

  &lt;pre class="alt"&gt;                            &lt;span class="kwrd"&gt;object&lt;/span&gt; o = WorkflowXamlServices.Load(File.OpenRead(&lt;span class="str"&gt;&amp;quot;Sequence1.xaml&amp;quot;&lt;/span&gt;));&lt;/pre&gt;

  &lt;pre&gt;                            Console.WriteLine(&lt;span class="str"&gt;&amp;quot;Success {0}&amp;quot;&lt;/span&gt;, o.GetType());&lt;/pre&gt;

  &lt;pre class="alt"&gt;                            DynamicActivity da = o &lt;span class="kwrd"&gt;as&lt;/span&gt; DynamicActivity;&lt;/pre&gt;

  &lt;pre&gt;                            da.Properties.ToList().ForEach(ap =&amp;gt; Console.WriteLine(&lt;span class="str"&gt;&amp;quot;argument: {0}&amp;quot;&lt;/span&gt;, ap.Name));&lt;/pre&gt;

  &lt;pre class="alt"&gt;                            WorkflowInvoker.Invoke(da, &lt;span class="kwrd"&gt;new&lt;/span&gt; Dictionary&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;, &lt;span class="kwrd"&gt;object&lt;/span&gt;&amp;gt; { { &lt;span class="str"&gt;&amp;quot;argument1&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;foo&amp;quot;&lt;/span&gt; }, { &lt;span class="str"&gt;&amp;quot;argument2&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;bar&amp;quot;&lt;/span&gt; } });&lt;/pre&gt;

  &lt;pre&gt;                        }&lt;/pre&gt;

  &lt;pre class="alt"&gt;                        &lt;span class="kwrd"&gt;catch&lt;/span&gt; (Exception ex)&lt;/pre&gt;

  &lt;pre&gt;                        {&lt;/pre&gt;

  &lt;pre class="alt"&gt;                            Console.WriteLine(&lt;span class="str"&gt;&amp;quot;Error {0}&amp;quot;&lt;/span&gt;, ex);&lt;/pre&gt;

  &lt;pre&gt;                        }&lt;/pre&gt;

  &lt;pre class="alt"&gt;                        &lt;span class="kwrd"&gt;break&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;                    &lt;span class="kwrd"&gt;case&lt;/span&gt; &lt;span class="str"&gt;'e'&lt;/span&gt;:&lt;/pre&gt;

  &lt;pre class="alt"&gt;                        WorkflowDesigner wd = &lt;span class="kwrd"&gt;new&lt;/span&gt; WorkflowDesigner();&lt;/pre&gt;

  &lt;pre&gt;                        wd.Load(&lt;span class="str"&gt;&amp;quot;Sequence1.xaml&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;                        &lt;span class="kwrd"&gt;object&lt;/span&gt; obj = wd.Context.Services.GetService&amp;lt;ModelService&amp;gt;().Root.GetCurrentValue();&lt;/pre&gt;

  &lt;pre&gt;                        Console.WriteLine(&lt;span class="str"&gt;&amp;quot;object read type: {0}&amp;quot;&lt;/span&gt;, obj.GetType());&lt;/pre&gt;

  &lt;pre class="alt"&gt;                        ActivitySchemaType schemaType = obj &lt;span class="kwrd"&gt;as&lt;/span&gt; ActivitySchemaType;&lt;/pre&gt;

  &lt;pre&gt;                        Console.WriteLine(&lt;span class="str"&gt;&amp;quot;schema type name: {0}&amp;quot;&lt;/span&gt;, schemaType.Name);&lt;/pre&gt;

  &lt;pre class="alt"&gt;                        schemaType.Members.ToList().ForEach(p =&amp;gt; Console.WriteLine(&lt;span class="str"&gt;&amp;quot;argument: {0}, type: {1}&amp;quot;&lt;/span&gt;, p.Name, p.Type));&lt;/pre&gt;

  &lt;pre&gt;                        &lt;span class="kwrd"&gt;break&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre class="alt"&gt;                    &lt;span class="kwrd"&gt;case&lt;/span&gt; &lt;span class="str"&gt;'q'&lt;/span&gt;:&lt;/pre&gt;

  &lt;pre&gt;                        doStuff = &lt;span class="kwrd"&gt;false&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre class="alt"&gt;                        &lt;span class="kwrd"&gt;break&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;                    &lt;span class="kwrd"&gt;default&lt;/span&gt;:&lt;/pre&gt;

  &lt;pre&gt;                        &lt;span class="kwrd"&gt;break&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre class="alt"&gt;                }&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;            }&lt;/pre&gt;

  &lt;pre&gt;            Console.WriteLine(&lt;span class="str"&gt;&amp;quot;All done&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;            Console.ReadLine();&lt;/pre&gt;

  &lt;pre&gt;        }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;object&lt;/span&gt; CreateWfObject()&lt;/pre&gt;

  &lt;pre class="alt"&gt;        {&lt;/pre&gt;

  &lt;pre&gt;            &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; Sequence { Activities = { &lt;span class="kwrd"&gt;new&lt;/span&gt; Persist(), &lt;span class="kwrd"&gt;new&lt;/span&gt; Persist() } };&lt;/pre&gt;

  &lt;pre class="alt"&gt;        }&lt;/pre&gt;

  &lt;pre&gt;    }&lt;/pre&gt;

  &lt;pre class="alt"&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9718703" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mwinkle/archive/tags/wf/default.aspx">wf</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/vs10/default.aspx">vs10</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/wf4/default.aspx">wf4</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/xaml/default.aspx">xaml</category></item><item><title>Introducing the WF4 Designer</title><link>http://blogs.msdn.com/mwinkle/archive/2009/05/20/introducing-the-wf4-designer.aspx</link><pubDate>Wed, 20 May 2009 20:27:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9632833</guid><dc:creator>mwinkle</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/mwinkle/comments/9632833.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mwinkle/commentrss.aspx?PostID=9632833</wfw:commentRss><description>&lt;p&gt;&lt;em&gt;// standard disclaimer applies, this is based on the released Beta 1 bits, things are subject to change, if you are reading this in 2012, things may be, look, smell, work differently.&amp;#160; That said, if it’s 2012 and you’re reading this, drop me a line and let me know how you found this!&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;As you might have heard, &lt;a href="http://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx"&gt;Beta1 of VS is out the door, and available to the public sometime today&lt;/a&gt;.&amp;#160; As you may know we’ve done a bunch of work for WF4, and I wanted to give a quick, high level overview of the designer.&amp;#160; &lt;a href="http://blogs.msdn.com/endpoint/archive/2009/05/20/vs-2010-and-net-framework-4-0-beta1-available-for-download.aspx"&gt;Here’s a good overview&lt;/a&gt; for the new WF bits all up.&lt;/p&gt;  &lt;p&gt;First, let’s start with your existing WF projects.&amp;#160; What happens if I want to create a 3.5 workflow?&amp;#160; We’re still shipping that designer, in fact, let’s start there on our tour.&amp;#160; This shows of a feature of VS that’s&amp;#160; pretty cool, multitargeting.&amp;#160; &lt;/p&gt;  &lt;p&gt;Click New Project&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb.png" width="596" height="429" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Notice the “Framework Version” dropdown in the upper right hand corner. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_28.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_13.png" width="409" height="186" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;This tells VS which version of the framework you would like the project you are creating to target.&amp;#160; This means you can still work on your existing projects in VS 2010 without upgrading your app to the new framework.&amp;#160; Let’s pick something that’s not 4.0, namely 3.5.&amp;#160; You’ll note that the templates may have updated a bit, select Workflow from the left hand tree view and see what shows up.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_4.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_1.png" width="604" height="446" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;There isn’t anything magical about what happens next, you will now see the 3.5 designer inside of VS2010.&amp;#160; You’re able to build, create, edit and update your existing WF applications.&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_6.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_2.png" width="424" height="523" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Let’s move on and switch over to a 4.0 workflow.&lt;/p&gt;  &lt;p&gt;Create a new project and select 4.0&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_8.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_3.png" width="529" height="389" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Create a new WF Sequential Console application and name it “SampleProject”.&amp;#160; Click Ok.&lt;/p&gt;  &lt;p&gt;We’ll do a little bit of work here, but you will shortly see the WF 4.0 designer.&amp;#160; It looks a little different from the 3.x days, we’ve taken this time to update the designer pretty substantially.&amp;#160; We’ve built it on top of WPF, which opens up the doors for us to do a lot of interesting things.&amp;#160; If you were at PDC and saw any Quadrant demos, you might think that these look similar. We haven’t locked on the final look and feel yet, so expect to see some additional changes there, but submit your feedback early and often, we want to know what you think.&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_10.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_4.png" width="464" height="575" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Let’s drop some activities into our sequence and see what’s there to be seen.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_12.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="image" border="0" alt="image" align="right" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_5.png" width="143" height="561" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;We’ve categorized the toolbox into functional groupings for the key activities.&amp;#160; We heard a lot of feedback that it was tough to know what to use when, so we wanted to provide a little more help with some richer default categories.&amp;#160; Add an Assign activity, a WriteLine activity and a Delay activity to the canvas by clicking and dragging over the to the sequence designer.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_14.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_6.png" width="223" height="305" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;You’ll note that we’ve now got some icons on each activity indicating something is not correct.&amp;#160; This is a result of the validation executing and returning details about what is wrong.&amp;#160; Think of these as the little red squiggles that show up when you spell something wrong.&amp;#160; You can hover over the icon to see what’s wrong&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_16.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_7.png" width="467" height="110" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;You can also see that errors will bubble up to their container, so hovering over sequence will tell you that there is a problem with the child activities.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_18.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_8.png" width="445" height="290" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;What if I have a big workflow, and what if I want to see a more detailed listing of errors?&amp;#160; Open up the Error View and you will see the validation results are also displayed here.&amp;#160; You’ll note there is some minor formatting weirdness.&amp;#160; This is a bug that we fixed but not in time for the Beta1 release.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_20.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_9.png" width="650" height="178" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Now, let’s actually wire up some data to this workflow.&amp;#160; WF4 has done a lot of work to be much more crisp about the way we think about data within the execution environment of a workflow. We divide the world into two types of data, Arguments, and Variables.&amp;#160; If you mentally map these to the way you write a method in code (parameters, and state internal to the method), you are one the right track.&amp;#160; Arguments determine the shape of an activity, what goes in, what goes out.&amp;#160; Variables allocate storage within the context of an activities execution.&amp;#160; The neat thing about variables, once the containing activity is done, we can get rid of the variables, as our workflow no longer needs them (note, we pass the important data in and out through the arguments).&amp;#160; To do this, we have two special designers on the canvas that contain information about the arguments and variables in your workflow &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_42.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_20.png" width="631" height="245" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;First, let’s click on the Argument designer and pass in some data.&amp;#160; &lt;/p&gt;  &lt;p&gt;Arguments consist of a few important elements&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Name &lt;/li&gt;    &lt;li&gt;Type &lt;/li&gt;    &lt;li&gt;Direction &lt;/li&gt;    &lt;li&gt;Default Value (Optional) &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_22.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_10.png" width="436" height="298" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;Most of these are self explanatory, with the one exception being the Direction.&amp;#160; You’ll note that this has In, Out and Property.&amp;#160; Now, when you are editing the arguments, you are actually editing the properties of the underlying type you are creating (I’ll explain more about this in a future post).&amp;#160; A more appropriate name might be “Property Editor” but the vast majority of what you’ll be creating with it is arguments.&amp;#160; Anyway, If you select In or Out, this basically wraps the type T in an InArgument, so it becomes a property of type InArgument&amp;lt;T&amp;gt;.&amp;#160; We just provide a bit of a shorthand so you don’t always have to pick InArgument as the type.&amp;#160; The default value takes an expression, but in this case, we won’t be using it.&lt;/p&gt;  &lt;p&gt;Let’s go ahead and add an argument of type TimeSpan named DelayTime.&amp;#160; You’ll need to select browse for types and then search for the TimeSpan&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_24.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_11.png" width="484" height="557" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Variables are similar, but slightly different, variables have a few important elements:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Name &lt;/li&gt;    &lt;li&gt;Type &lt;/li&gt;    &lt;li&gt;Scope &lt;/li&gt;    &lt;li&gt;Default Value (Optional) &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Remember earlier, I mentioned that variable is part of an activity, this is what Scope refers to.&amp;#160; Variables will only show up to be the scope of the selected activity, so if you don’t see any, make sure to select the Sequence, and then you will be able to add a variable.&amp;#160; Let’s add new variable, named StringToPrint, of type String.&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_26.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_12.png" width="431" height="297" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Now let’s do something with these in the workflow.&amp;#160; One thing I’m particularly happy with that we’ve done on the designer side of things is to enable people to build activity designers more easily.&amp;#160; There are lots of times where you have activities that have just a few key properties that need to be set, and you’d like to be able to see that “at a glance”&amp;#160; The assign designer is like that.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_30.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_14.png" width="267" height="102" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Now, let’s dig into expressions.&amp;#160; One big piece of feedback from 3.0 was that people really wanted richer binding experiences.&amp;#160; You see this as well with the WPF data binding .&amp;#160; We’ve taken it to the next level, and allow any expression to be expressed as a set of activities.&amp;#160; What this means is that we do have to “compile” textual expressions into a tree of activities, and this is one of the reasons we use VB to build expressions.&amp;#160; In the fullness of time, other languages will come on board. But how to use it, let’s see.&amp;#160; Click on the “To” text box on the Assign activity.&amp;#160; You will see a brief change of the text box, and then you will be in a VB Expression Editor, or what we’ve come to refer to as “The Expression Text Box” or ETB.&amp;#160; Start typing S, and already you will see intellisense begin to scope down the choices.&amp;#160; This will pick up all of the variables and arguments in scope.&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_32.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_15.png" width="330" height="314" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;On the right side, we won’t use any of the passed in arguments, we’ll show off a richer expression.&amp;#160;&amp;#160; Now, the space on the right side of the designer is kind of tight for something lengthy, so go to the property grid and click on the “…” button for the Value property &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_34.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_16.png" width="580" height="404" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;String&lt;/span&gt;.Format(&lt;span class="str"&gt;&amp;quot;Someone wants to wait {0} seconds&amp;quot;&lt;/span&gt;, TimeToWait.TotalSeconds)&lt;/pre&gt;
&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;This just touches the surface of what is possible with expressions in WF4, we can really get&amp;#160; much richer expressions (3.x expressions are similar to WPF data binding, they are really an “object” + “target” structure).&lt;/p&gt;

&lt;p&gt;Not everything makes it to the canvas of the designer surface, and for that, we have the property grid.&amp;#160; If you’ve used the WPF designer in VS2008, this should look pretty familiar to you.&amp;#160; Select the delay activity, and use the property grid to set the duration property to the InArgument you created above.&amp;#160; This experience is similar, with the ETB embedded into the property grid for arguments. &lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Finally, repeat with the WriteLine and bind to the StringToPrint variable.&lt;/p&gt;

&lt;h1&gt;Navigating the Workflow&lt;/h1&gt;

&lt;p&gt;There are two different things that we have to help navigating the workflow, our breadcrumb bar at the top and the overview map (which appears as the “Mini Map” in the beta).&amp;#160; Let’s look at the overview map.&amp;#160; This gives you a view of the entire workflow and the ability to quickly scrub and scroll across it.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_36.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_17.png" width="337" height="531" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Finally, across the top we display our breadcrumbs which are useful when you have a highly nested workflow.&amp;#160; Double click on one of the activities, and you should see the designer “drill into” that activity.&amp;#160; Now notice the breadcrumb bar, it displays where you have been, and by clicking you can navigate back up the hierarchy.&amp;#160; In beta1, we have a pretty aggressive breadcrumb behavior, and so you see “collapsed in place” as the default for many of our designers.&amp;#160; We’re probably going to relax that a bit in upcoming milestones to reduce clicking and provide a better overview of the workflow.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_40.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_19.png" width="402" height="530" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Finally, there may be times where we don’t want to have a designer view, but would rather see the XAML.&amp;#160; To get there, just right click on the file and ask to “View Code”&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_38.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_18.png" width="236" height="362" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;This will currently ask you if you are sure that you want to close the designer, and you will then see the XAML displayed in the XML editor.&amp;#160; For the workflow we just created, this is what it looks like:&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p:Activity&lt;/span&gt; &lt;span class="attr"&gt;mc:Ignorable&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;&amp;quot;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;     &lt;span class="attr"&gt;x:Class&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;WorkflowConsoleApplication1.Sequence1&amp;quot;&lt;/span&gt; &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;     &lt;span class="attr"&gt;xmlns&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://schemas.microsoft.com/netfx/2009/xaml/activities/design&amp;quot;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;     &lt;span class="attr"&gt;xmlns:__Sequence1&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;clr-namespace:WorkflowConsoleApplication1;&amp;quot;&lt;/span&gt; &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;     &lt;span class="attr"&gt;xmlns:mc&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://schemas.openxmlformats.org/markup-compatibility/2006&amp;quot;&lt;/span&gt; &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;     &lt;span class="attr"&gt;xmlns:p&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://schemas.microsoft.com/netfx/2009/xaml/activities&amp;quot;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;     &lt;span class="attr"&gt;xmlns:s&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;clr-namespace:System;assembly=mscorlib&amp;quot;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;     &lt;span class="attr"&gt;xmlns:sad&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;clr-namespace:System.Activities.Debugger;assembly=System.Activities&amp;quot;&lt;/span&gt; &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;     &lt;span class="attr"&gt;xmlns:x&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;x:Members&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;x:Property&lt;/span&gt; &lt;span class="attr"&gt;Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;TimeToWait&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;p:InArgument(s:TimeSpan)&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;x:Members&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;__Sequence1:Sequence1.TimeToWait&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p:InArgument&lt;/span&gt; &lt;span class="attr"&gt;x:TypeArguments&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;s:TimeSpan&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;[TimeSpan.FromSeconds(10)]&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;p:InArgument&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;__Sequence1:Sequence1.TimeToWait&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p:Sequence&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p:Sequence.Variables&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p:Variable&lt;/span&gt; &lt;span class="attr"&gt;x:TypeArguments&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;x:String&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;StringToPrint&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;p:Sequence.Variables&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p:Assign&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p:Assign.To&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p:OutArgument&lt;/span&gt; &lt;span class="attr"&gt;x:TypeArguments&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;x:String&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;            [StringToPrint]&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;p:OutArgument&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;      &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;p:Assign.To&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p:Assign.Value&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p:InArgument&lt;/span&gt; &lt;span class="attr"&gt;x:TypeArguments&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;x:String&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;                  [String.Format(&amp;quot;Someone wants to wait {0} seconds&amp;quot;, TimeToWait.TotalSeconds)]&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;         &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;p:InArgument&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;      &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;p:Assign.Value&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;p:Assign&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p:Delay&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;[TimeToWait]&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;p:Delay&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p:WriteLine&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;[StringToPrint]&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;p:WriteLine&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;p:Sequence&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;p:Activity&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h1&gt;Executing the Workflow&lt;/h1&gt;

&lt;p&gt;Inside the project you will see the Program.cs to execute the workflow, let’s take a look at that. &lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; WorkflowConsoleApplication1&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; System;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; System.Linq;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; System.Threading;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; System.Activities;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; System.Activities.Statements;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;    &lt;span class="kwrd"&gt;class&lt;/span&gt; Program&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;        &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;        {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;            AutoResetEvent syncEvent = &lt;span class="kwrd"&gt;new&lt;/span&gt; AutoResetEvent(&lt;span class="kwrd"&gt;false&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;            WorkflowInstance myInstance =&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;                &lt;span class="kwrd"&gt;new&lt;/span&gt; WorkflowInstance(&lt;span class="kwrd"&gt;new&lt;/span&gt; Sequence1(),&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;                    &lt;span class="kwrd"&gt;new&lt;/span&gt; Dictionary&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;, &lt;span class="kwrd"&gt;object&lt;/span&gt;&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;                    {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;                        {&lt;span class="str"&gt;&amp;quot;TimeToWait&amp;quot;&lt;/span&gt;, TimeSpan.FromSeconds(3.5) }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;                    }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;                    );&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;            myInstance.OnCompleted = &lt;span class="kwrd"&gt;delegate&lt;/span&gt;(WorkflowCompletedEventArgs e) { syncEvent.Set(); };&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;            myInstance.OnUnhandledException = &lt;span class="kwrd"&gt;delegate&lt;/span&gt;(WorkflowUnhandledExceptionEventArgs e)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;            {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;                Console.WriteLine(e.UnhandledException.ToString());&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;                &lt;span class="kwrd"&gt;return&lt;/span&gt; UnhandledExceptionAction.Terminate;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;            };&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;            myInstance.OnAborted = &lt;span class="kwrd"&gt;delegate&lt;/span&gt;(WorkflowAbortedEventArgs e)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;            {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;                Console.WriteLine(e.Reason);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;                syncEvent.Set();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;            };&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;            myInstance.Run();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  40:  &lt;/span&gt;            syncEvent.WaitOne();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  41:  &lt;/span&gt;            Console.WriteLine(&lt;span class="str"&gt;&amp;quot;Press &amp;lt;Enter&amp;gt; to exit&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  42:  &lt;/span&gt;            Console.ReadLine();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  43:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  44:  &lt;/span&gt;        }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  45:  &lt;/span&gt;    }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  46:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;This is the standard program.cs template with two modifications.&amp;#160; The first is passing data into the workflow, indicated by the dictionary we create to pass into the WorkflowInstance.&amp;#160; This should look familiar if you have used WF in the past. &lt;/p&gt;

&lt;pre class="csharpcode"&gt; WorkflowInstance myInstance =
                &lt;span class="kwrd"&gt;new&lt;/span&gt; WorkflowInstance(&lt;span class="kwrd"&gt;new&lt;/span&gt; Sequence1(),
                    &lt;span class="kwrd"&gt;new&lt;/span&gt; Dictionary&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;, &lt;span class="kwrd"&gt;object&lt;/span&gt;&amp;gt;
                    {
                        {&lt;span class="str"&gt;&amp;quot;TimeToWait&amp;quot;&lt;/span&gt;, TimeSpan.FromSeconds(3.5) }
                    }
                 );&lt;/pre&gt;
&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;The second is a break at the end to keep our console window open (lines 41 and 42).&amp;#160; Hitting F5 from our project results in the following output (as expected).&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_44.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_21.png" width="550" height="381" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;This concludes our brief tour through the new WF designer.&amp;#160; I’ll be talking a lot more in upcoming days about some of the more programmatic aspects of it and how it’s put together. &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9632833" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mwinkle/archive/tags/wf/default.aspx">wf</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/vNext/default.aspx">vNext</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/vs10/default.aspx">vs10</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/wf4/default.aspx">wf4</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/beta/default.aspx">beta</category></item><item><title>10-4 Good Buddy, First Look at WF 4</title><link>http://blogs.msdn.com/mwinkle/archive/2009/04/16/10-4-good-buddy-first-look-at-wf-4.aspx</link><pubDate>Thu, 16 Apr 2009 17:30:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9553216</guid><dc:creator>mwinkle</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/mwinkle/comments/9553216.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mwinkle/commentrss.aspx?PostID=9553216</wfw:commentRss><description>&lt;p&gt;Our WF evangelist, &lt;a href="http://blogs.msdn.com/rjacobs/" target="_blank"&gt;Ron Jacobs&lt;/a&gt;, just posted a &lt;a href="http://channel9.msdn.com/shows/10-4/10-4-Episode-16-Windows-Workflow-4/" target="_blank"&gt;10-4 screencast&lt;/a&gt; that walks through WF4 as it's looking in VS 2010.&amp;#160; This is a good first look at our bits since PDC (we've changed things a little bit).&amp;#160; I really like that he takes it from a unit testing perspective.&amp;#160; There are certainly things that have been added (like WorkflowInvoker.Invoke) which will make testing activities a lot easier than the 3.0 days.&lt;/p&gt;  &lt;p&gt;Check it out, let me know if you've got feedback.&amp;#160; &lt;/p&gt;   &lt;p&gt; &lt;object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="320" height="240"&gt; &lt;param name="source" value="http://channel9.msdn.com/App_Themes/default/VideoPlayer2009_03_17.xap" /&gt; &lt;param name="initParams" value="m=http://mschnlnine.vo.llnwd.net/d1/ch9/0/2/6/5/6/4/104Episode16Workflow_2MB_ch9.wmv,autostart=false,autohide=true,showembed=true, thumbnail=http://mschnlnine.vo.llnwd.net/d1/ch9/0/2/6/5/6/4/104Episode16Workflow_large_ch9.png, postid=465620" /&gt; &lt;param name="background" value="#00FFFFFF" /&gt; &lt;a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"&gt; &lt;img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" /&gt; &lt;/a&gt; &lt;/object&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9553216" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mwinkle/archive/tags/wf/default.aspx">wf</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/screencasts/default.aspx">screencasts</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/vNext/default.aspx">vNext</category></item><item><title>WF 4.0 -- Designer Type Visibility</title><link>http://blogs.msdn.com/mwinkle/archive/2009/02/12/wf-4-0-designer-type-visibility.aspx</link><pubDate>Thu, 12 Feb 2009 21:03:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9415824</guid><dc:creator>mwinkle</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/mwinkle/comments/9415824.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mwinkle/commentrss.aspx?PostID=9415824</wfw:commentRss><description>&lt;p&gt;One of the exercises I'm going through now is scrubbing our API and taking a hard look at types marked as public and trying to decide &amp;quot;does it really need to be public.&amp;quot;&amp;#160; While on first blush, you can    &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;What I'd love to get from folks are answers to the following questions:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Were there designer types in 3.0/3.5 that were not public that caused you problems?&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;If so, why?&amp;#160; What and how did you want to use that type?&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;Were there scenarios where you found our decisions on type visibility odd, inconsistent or painful?&amp;#160; Let me know what those were.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Looking forward to your thoughts!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9415824" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mwinkle/archive/tags/wf/default.aspx">wf</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/vNext/default.aspx">vNext</category></item><item><title>Endpoint.tv Talks Tracking</title><link>http://blogs.msdn.com/mwinkle/archive/2009/01/14/endpoint-tv-talks-tracking.aspx</link><pubDate>Wed, 14 Jan 2009 21:46:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9319479</guid><dc:creator>mwinkle</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/mwinkle/comments/9319479.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mwinkle/commentrss.aspx?PostID=9319479</wfw:commentRss><description>&lt;p&gt;I heard that the folks that bring you &lt;a href="http://channel9.msdn.com/shows/Endpoint/" target="_blank"&gt;endpoint.tv&lt;/a&gt; are doing a two part series on Workflow Tracking in 3.0/3.5.&amp;#160; This is one of my favorite feature areas in 3.0/3.5, and one that I think is not talked about too often.&amp;#160; The team built a lot of functionality in there besides the very basic &amp;quot;emit tracking info&amp;quot; one might expect with the feature description.&lt;/p&gt;  &lt;p&gt;Check &lt;a href="http://channel9.msdn.com/shows/Endpoint/endpointtv-Screencast-Using-SQL-Tracking-Services-with-WF/" target="_blank"&gt;it out&lt;/a&gt;, and if you want some other background, check out these blog posts I made a few years back!&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://blogs.msdn.com/mwinkle/archive/2007/01/24/tracking-objects-and-querying-for-them.aspx" target="_blank"&gt;Tracking Objects and Querying For Them&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/mwinkle/archive/2007/09/11/tracking-gem-in-sdk-documentation.aspx" target="_blank"&gt;Tracking Gem in the SDK (or, what do all the tables do)&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9319479" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mwinkle/archive/tags/wf/default.aspx">wf</category></item><item><title>Thoughts on Waiting until 20xx for WF</title><link>http://blogs.msdn.com/mwinkle/archive/2009/01/06/thoughts-on-waiting-until-20xx-for-wf.aspx</link><pubDate>Tue, 06 Jan 2009 21:55:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9286240</guid><dc:creator>mwinkle</dc:creator><slash:comments>10</slash:comments><comments>http://blogs.msdn.com/mwinkle/comments/9286240.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mwinkle/commentrss.aspx?PostID=9286240</wfw:commentRss><description>&lt;P&gt;&lt;EM&gt;Usual msblog disclaimer applies, this represents my opinion!&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;While I was on break, a number of folks pinged me asking me about &lt;A href="http://realworldsa.dotnetdevelopersjournal.com/goodbyewindowsworkflowfoundationseeyouin2011.htm" target=_blank mce_href="http://realworldsa.dotnetdevelopersjournal.com/goodbyewindowsworkflowfoundationseeyouin2011.htm"&gt;this blog post&lt;/A&gt; by Tad Anderson.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;I find the investment in time to learn how to use 3.0/3.5 has been a complete waste time. So we have release 1.0 and 1.5 of WWF becoming obsolete in favor of version 2.0. These are the real release numbers on these libraries, and that is how they should have been labeled. They are not release 3.0 and 3.5.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;First, your investment in the existing technologies is not a "waste of time."&amp;nbsp; The idea of modeling your app logic declaratively, via workflows doesn't change, nor do the ideas surrounding how one builds an application with workflows.&amp;nbsp; What we are fixing is that we are making it substantially easier to use, and enabling more advanced scenarios (like implicit message correlation). What you will not be able to re-use is some of the things you did the first time and thought, "hmmm, I wonder why I have to do that [activity execution context cloning, handleExternalEvent, I'm looking at you]."&amp;nbsp; From a designer perspective, your not going to have to keep remembering the quirks of the v1 designer.&amp;nbsp; I think about this similarly to the way we went from ASMX web services to WCF.&amp;nbsp; The API's changed, but the underlying thinking of building an app on services did not.&amp;nbsp; Regarding version numbers, all of our libraries are versioned to the version of the framework we ship with (see WPF, WCF, etc).&amp;nbsp; Internally we struggled with what we call the thing we're working on now and decided to stick with framework version (so WF 4.0, rather than WF 2.0).&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Secondly, it's important to note, we're not getting rid of the 3.0, 3.5 technologies.&amp;nbsp; We're investing to port them to the new CLR, and work to make the designers operate in VS 2010.&amp;nbsp; &lt;STRONG&gt;&lt;EM&gt;If you get sufficient return by using WF in your apps today, use WF today.&amp;nbsp; If WF doesn't meet your needs today, and if we're fixing that by something that we're doing in 4.0, then it makes sense to wait.&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp; Note, I'm not defining "return" for you.&amp;nbsp; Depending upon how you define that, you may reach a different conclusion that someone in a similar setting.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Thirdly, activities you write today on 3.0/3.5 will continue to work, even inside a 4.0 workflow by way of the interop activity.&amp;nbsp; Much as WPF has the ability to host existing WinForms content, we have the ability to execute 3.0-based activities.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;There is a larger issue of how we (the big, Microsoft "we") handle a combination of innovation, existing application compatibility, and packaging of features.&amp;nbsp; I'm not sure how we avoid the fact that inevitably, any framework in version n+1 will introduce new features, some of which will not be compatible with framework version n, some of which may do similar things to features in framework version n.&amp;nbsp; Folks didn't stop writing WinFroms apps when WPF was announced (they still write WinForms apps).&amp;nbsp; As I mentioned, this is a big issue, but not one I intend to tackle in this post :-) &lt;/P&gt;
&lt;P&gt;The feedback we got from customers around WF was centered around the need for a few things:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Activities and Workflows&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;A fully declarative experience (declare everything in XAML)&lt;/LI&gt;
&lt;LI&gt;Make it easier to write complex activities (see my talk for the discussion on writing Parallel or NofM)&lt;/LI&gt;
&lt;LI&gt;Make data binding easier&lt;/LI&gt;&lt;/UL&gt;
&lt;LI&gt;Runtime&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;Better control over persistence&lt;/LI&gt;
&lt;LI&gt;Flow-in transactions&lt;/LI&gt;
&lt;LI&gt;Support partial trust &lt;/LI&gt;
&lt;LI&gt;Increase perf&lt;/LI&gt;&lt;/UL&gt;
&lt;LI&gt;Tooling&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;Fix Perf and usability&lt;/LI&gt;
&lt;LI&gt;Make rehosting and extensibility easier&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;
&lt;P&gt;Most of these would require changes to the existing code base, and breaking changes would become unavoidable.&amp;nbsp; The combination of doing all of these things makes the idea of breaking all existing customers absolutely untenable.&amp;nbsp; We're doing the work to make sure that your WF apps you write today will keep on working, and with services as the mechanisms to communicate between them, one can gradually introduce 4.0 apps as well.&amp;nbsp; Given the commitment we have to our v1&amp;nbsp; (or netfx3) customers, we don't want to introduce those kinds of breaking changes.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2949" target=_blank mce_href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2949"&gt;Kathleen's article&lt;/A&gt; summarizes this very nicely, and rather than be accused of cherry-picking quotes, I encourage you to read the whole article.&lt;/P&gt;
&lt;P&gt;Questions, comments, violent flames, post 'em here or mwinkle_at_largeredmondbasedsoftwarecompany_dot_com&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9286240" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mwinkle/archive/tags/wf/default.aspx">wf</category></item><item><title>How I Spent My Winter Vacation</title><link>http://blogs.msdn.com/mwinkle/archive/2009/01/05/how-i-spent-my-winter-vacation.aspx</link><pubDate>Mon, 05 Jan 2009 18:35:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9282562</guid><dc:creator>mwinkle</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/mwinkle/comments/9282562.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mwinkle/commentrss.aspx?PostID=9282562</wfw:commentRss><description>&lt;p&gt;I haven't posted since prior to PDC, and since then it's been a whirl wind.&amp;#160; You see, in the middle of September, my wife and I had a healthy baby boy, so I've been a little busy since then with things like diapers, visiting family, etc.&amp;#160; Given the huge time crunch of PDC, I decided to cash in on Microsoft's awesome &lt;a href="http://members.microsoft.com/careers/mslife/benefits/plan.mspx"&gt;parental leave benefit&lt;/a&gt; and I have been away from work for a little over a month.&amp;#160; &lt;/p&gt;  &lt;p&gt;I started working for my dad's company during the summer when I was still in &lt;a href="http://www.sluh.org"&gt;high school&lt;/a&gt;, in &lt;a href="http://www.denison.edu/academics/departments/mathcs/aboutcs.html"&gt;college&lt;/a&gt; I worked summers to pay tuition, and following graduation went right to &lt;a href="http://www.lrs.com/"&gt;work&lt;/a&gt; two weeks later.&amp;#160; I've never taken this much time away from work, &lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/HowISpentMyWinterVacation_92E9/image_2.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; margin: 5px 10px 0px 5px; border-left: 0px; border-bottom: 0px" height="255" alt="brendan with grin" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/HowISpentMyWinterVacation_92E9/image_thumb.png" width="380" align="left" border="0" /&gt;&lt;/a&gt;and I sorely regret not having done it sooner.&amp;#160; When my daughter was born, I was unable to take much more than a week or so off, and I miss having been able to spend this kind of time with her. My boss and grand-boss were very supportive, including a few gentle slaps on the wrist when I did log in to check on a few emails.&lt;/p&gt;  &lt;p&gt;This gave me a great opportunity to really unplug after a crazy year, and an even crazier PDC.&amp;#160; Most importantly though, it let me really spend a lot of quality time with my new son while he's at a pretty fun age (as you can see from the grin)&lt;/p&gt;  &lt;p&gt;I stayed pretty true to my commitment to avoid work stuff, but I did keep up on tech news (including fun rumors) and started to lurk through some &lt;a href="http://blog.wekeroad.com/" target="_blank"&gt;ASP.NET MVC&lt;/a&gt; stuff earlier in the break.&amp;#160; I've begun to become much more addicted to google reader, &lt;a href="http://friendfeed.com/mwinkle" target="_blank"&gt;friendfeed&lt;/a&gt; and &lt;a href="http://twitter.com/mwinkle" target="_blank"&gt;twitter&lt;/a&gt; than is probably healthy&lt;/p&gt;  &lt;p&gt;I also got to do a fair amount of reflection on work, what we're doing, what I'm doing, and how excited I am about the work that my &lt;a href="http://msdn.com/oslo"&gt;team&lt;/a&gt; is doing. &lt;/p&gt;  &lt;p&gt;I'll be getting back to my more regular series of postings, first on some WF things, and then I'll start doing more posts on Oslo and more specifically, Quadrant.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9282562" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mwinkle/archive/tags/misc/default.aspx">misc</category></item><item><title>Which WF/WCF Talks Should You Attend at PDC?</title><link>http://blogs.msdn.com/mwinkle/archive/2008/10/03/which-wf-wcf-talks-should-you-attend-at-pdc.aspx</link><pubDate>Thu, 02 Oct 2008 23:19:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8974616</guid><dc:creator>mwinkle</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/mwinkle/comments/8974616.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mwinkle/commentrss.aspx?PostID=8974616</wfw:commentRss><description>&lt;p&gt;Just got the email the other day that PDC is less than 4 weeks away, and it got me thinking a bit about how I would think about these sessions as an attendee.&amp;#160; Searching on the &lt;a href="https://sessions.microsoftpdc.com/public/sessions.aspx"&gt;PDC site&lt;/a&gt; will yield 8 talks tagged with WF.&amp;#160;&amp;#160; Here's how I break some of these these down, the first few are about using WF, and the last 3 are about WF itself:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;strong&gt;&lt;em&gt;&lt;a href="http://channel9.msdn.com/pdc2008/BB18/"&gt;Hosting Workflows and Services&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;    &lt;p&gt;Dan Eshner&lt;/p&gt;    &lt;p&gt;Hear about extensions being made to Windows Server to provide a feature-rich middle-tier execution and deployment environment for Windows Workflow Foundation (WF) and Windows Communication Foundation (WCF) applications. Learn about the architecture of this new extension, how it works, how to take advantage of it, and the features it provides that simplify deployment, management, and troubleshooting of workflows and services.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;This talk is all about the host we're building for WF and WCF, which I mentioned earlier, we're calling &amp;quot;Dublin&amp;quot;.&amp;#160; If you're familiar with either technology, and have built a host of your own, this will be interesting both from the perspective of what is coming, as well as how we are thinking about solving some of the hosting problems.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;strong&gt;&lt;em&gt;&lt;a href="http://channel9.msdn.com/pdc2008/TL23/"&gt;A Lap around &amp;quot;Oslo&amp;quot;&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;    &lt;p&gt;Presenters: &lt;a href="http://www.douglasp.com"&gt;Douglas Purdy&lt;/a&gt;, Vijaye Raji&lt;/p&gt;    &lt;p&gt;&amp;quot;Oslo&amp;quot; is the family of new technologies that enable data-driven development and execution of services and applications. Come and learn how to capture all aspects of an application schematized in the &amp;quot;Oslo&amp;quot; repository and use &amp;quot;Oslo&amp;quot; directly to drive the execution of deployed applications.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Building declarative or data driven apps is a &amp;quot;thing&amp;quot; in the Oslo world.&amp;#160; This talk will give the big picture of all of the various pieces of Oslo, and how existing declarative technologies, like WF and WCF fit into it.&amp;#160; Note, this talk is not primarily about WF or WCF, rather it is about Oslo, which you can read about in more detail here and here.&lt;/p&gt;  &lt;p&gt;What about all of the things we are doing to WCF and WF in .NET 4?&amp;#160; That's the remaining three talks:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;&lt;a href="http://channel9.msdn.com/pdc2008/TL17/"&gt;&lt;strong&gt;Windows Workflow Foundation 4.0: A First Look&lt;/strong&gt;&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;    &lt;p&gt;Presenter: &lt;a href="http://www.kennyw.com"&gt;Kenny Wolf&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;Programs coordinate work. The code for coordination and state management often obscures a program's purpose. Learn how programming with Windows Workflow Foundation (WF) 4.0 provides clarity of intent while preserving the functional richness of the .NET framework. See how easy it is to build workflows with the new Visual Studio workflow designer. Learn about text-based authoring options for WF. Hear how WF integrates well with other Microsoft technologies (WCF, WPF, ASP.NET). If you've looked at WF before, come and see the changes to data flow, composition, and new control flow styles. Significant improvements to usability, composability, and performance make Workflow a great fit for a broad range of solutions on both the client and the server.&lt;/p&gt;    &lt;p&gt;&lt;em&gt;&lt;a href="http://channel9.msdn.com/pdc2008/TL21/"&gt;&lt;strong&gt;Windows Workflow Foundation 4.0: Extending with Custom Activities&lt;/strong&gt;&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;    &lt;p&gt;Presenter: &lt;a href="http://blogs.msdn.com/mwinkle"&gt;Matt Winkler&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;Windows Workflow Foundation (WF) coordinates and manages individual units of work, encapsulated into activities. WF comes with a rich library of activities. Learn how to extend this library by encapsulating your own APIs with custom activities. See how to compose those basic activities into higher level units using rules, flowchart, and state machine control flow styles. Learn how to build your own WF control styles. Learn how to customize and re-host the workflow authoring experience using the new WF designer framework.&lt;/p&gt;    &lt;p&gt;&lt;em&gt;&lt;a href="http://channel9.msdn.com/pdc2008/TL06/"&gt;&lt;strong&gt;Windows Communication Foundation 4.0: Building WCF Services with Windows Workflow Foundation in Microsoft .NET 4.0&lt;/strong&gt;&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;    &lt;p&gt;Presenter: Ed Pinto&lt;/p&gt;    &lt;p&gt;Eliminate the tradeoff between ease of service authoring and performant, scalable services. Hear about significant enhancements in WCF and WF to deal with the ever increasing complexity of communication. Learn how to use WCF to correlate messages to service instances using transport, context, and application payloads. See how the new WF messaging activities enable the modeling of rich protocols. Learn how WCF provides a default host for workflows exposing features such as distributed compensation and discovery. See how service definition in XAML completes the union of WF and WCF with a unified authoring experience that simplifies configuration and is fully integrated with IIS activation and deployment.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Kenny's talk will be an introduction to all of the new features in WF.&amp;#160; If you haven't used WF, or if you looked at WF before and decided it wasn't right for your solution, come to this talk to see how WF makes writing programs easier.&amp;#160; If you are using WF today, and want to see what has changed, this will be a good talk for you.&lt;/p&gt;  &lt;p&gt;My talk will be a very hands on, write some code, style talk focused on building activities and all of the aspects of WF that impact activity development.&amp;#160; If you are using WF today, and want to see what the changes mean for the code you'll write, this is the talk for you.&amp;#160; Also, if you attend Kenny's talk and think, &amp;quot;hey, I want to learn more&amp;quot; this will also be the talk for you.&amp;#160; My talk won't focus on the &amp;quot;why&amp;quot; or the &amp;quot;where&amp;quot; of workflow, but more the &amp;quot;how to build&amp;quot; parts.&lt;/p&gt;  &lt;p&gt;Finally, Ed's talk is &lt;strong&gt;&lt;em&gt;the&lt;/em&gt;&lt;/strong&gt; talk to go to if you are a WCF&amp;#160; developer. If you are building programs that consume services, where service is very loosely defined integrating external information into your app, you should also make sure to go to this talk.&amp;#160; This talk will highlight a number of the enhancements that have been made both to WCF and to the integration between WF and WCF.&amp;#160; We believe very strongly that WF and WCF are tremendously complementary technologies. &lt;/p&gt;  &lt;p&gt;To help, I've put together the following decision table to help you decide.&amp;#160; There are three possible actions, &amp;quot;Must Attend&amp;quot; &amp;quot;Should attend&amp;quot; and &amp;quot;Would Enjoy&amp;quot;.&amp;#160; I think they are fairly explanatory actions, but if you have questions, let me know.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;table style="width: 400pt; border-collapse: collapse" cellspacing="0" cellpadding="0" width="863" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 233pt; mso-width-source: userset; mso-width-alt: 11373" width="311" /&gt;&lt;col style="width: 130pt; mso-width-source: userset; mso-width-alt: 6326" width="173" /&gt;&lt;col style="width: 159pt; mso-width-source: userset; mso-width-alt: 7753" width="212" /&gt;&lt;col style="width: 204pt; mso-width-source: userset; mso-width-alt: 9947" width="272" /&gt;&lt;/colgroup&gt;&lt;tbody&gt;     &lt;tr style="height: 15pt" height="20"&gt;       &lt;td style="border-right: #fac090 0.5pt solid; border-top: #fac090 0.5pt solid; font-weight: 700; font-size: 11pt; background: #fde9d9; border-left: #fac090 0.5pt solid; width: 233pt; color: black; border-bottom: #fac090 0.5pt solid; font-family: calibri; height: 15pt; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #fde9d9 none" width="310" height="20"&gt;&amp;#160;&lt;/td&gt;        &lt;td class="xl66" style="border-right: #fac090 0.5pt solid; border-top: #fac090 0.5pt solid; font-weight: 700; font-size: 11pt; background: #fde9d9; border-left: medium none; width: 130pt; color: black; border-bottom: #fac090 0.5pt solid; font-family: calibri; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #fde9d9 none" width="173"&gt;Kenny's talk: A First look&lt;/td&gt;        &lt;td class="xl66" style="border-right: #fac090 0.5pt solid; border-top: #fac090 0.5pt solid; font-weight: 700; font-size: 11pt; background: #fde9d9; border-left: medium none; width: 159pt; color: black; border-bottom: #fac090 0.5pt solid; font-family: calibri; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #fde9d9 none" width="212"&gt;Matt's Talk : Building Activities&lt;/td&gt;        &lt;td class="xl66" style="border-right: #fac090 0.5pt solid; border-top: #fac090 0.5pt solid; font-weight: 700; font-size: 11pt; background: #fde9d9; border-left: medium none; width: 204pt; color: black; border-bottom: #fac090 0.5pt solid; font-family: calibri; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #fde9d9 none" width="166"&gt;Ed's talk: Building WCF Services with WF&lt;/td&gt;     &lt;/tr&gt;      &lt;tr style="height: 15pt" height="20"&gt;       &lt;td class="xl66" style="border-right: #fac090 0.5pt solid; border-top: medium none; font-weight: 700; font-size: 11pt; background: #fcd5b4; border-left: #fac090 0.5pt solid; color: black; border-bottom: #fac090 0.5pt solid; font-family: calibri; height: 15pt; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #fcd5b4 none" width="310" height="20"&gt;Building WF today&lt;/td&gt;        &lt;td class="xl65" style="border-right: #fac090 0.5pt solid; border-top: medium none; font-weight: 400; font-size: 11pt; background: #fcd5b4; border-left: medium none; color: black; border-bottom: #fac090 0.5pt solid; font-family: calibri; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #fcd5b4 none" width="173"&gt;Must attend&lt;/td&gt;        &lt;td class="xl65" style="border-right: #fac090 0.5pt solid; border-top: medium none; font-weight: 400; font-size: 11pt; background: #fcd5b4; border-left: medium none; color: black; border-bottom: #fac090 0.5pt solid; font-family: calibri; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #fcd5b4 none" width="212"&gt;Must attend&lt;/td&gt;        &lt;td class="xl65" style="border-right: #fac090 0.5pt solid; border-top: medium none; font-weight: 400; font-size: 11pt; background: #fcd5b4; border-left: medium none; color: black; border-bottom: #fac090 0.5pt solid; font-family: calibri; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #fcd5b4 none" width="166"&gt;Must attend&lt;/td&gt;     &lt;/tr&gt;      &lt;tr style="height: 15pt" height="20"&gt;       &lt;td class="xl66" style="border-right: #fac090 0.5pt solid; border-top: medium none; font-weight: 700; font-size: 11pt; background: #fde9d9; border-left: #fac090 0.5pt solid; color: black; border-bottom: #fac090 0.5pt solid; font-family: calibri; height: 15pt; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #fde9d9 none" width="310" height="20"&gt;Building WCF today&lt;/td&gt;        &lt;td class="xl65" style="border-right: #fac090 0.5pt solid; border-top: medium none; font-weight: 400; font-size: 11pt; background: #fde9d9; border-left: medium none; color: black; border-bottom: #fac090 0.5pt solid; font-family: calibri; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #fde9d9 none" width="173"&gt;Should attend&lt;/td&gt;        &lt;td class="xl65" style="border-right: #fac090 0.5pt solid; border-top: medium none; font-weight: 400; font-size: 11pt; background: #fde9d9; border-left: medium none; color: black; border-bottom: #fac090 0.5pt solid; font-family: calibri; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #fde9d9 none" width="212"&gt;Should attend&lt;/td&gt;        &lt;td class="xl65" style="border-right: #fac090 0.5pt solid; border-top: medium none; font-weight: 400; font-size: 11pt; background: #fde9d9; border-left: medium none; color: black; border-bottom: #fac090 0.5pt solid; font-family: calibri; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #fde9d9 none" width="166"&gt;Must attend&lt;/td&gt;     &lt;/tr&gt;      &lt;tr style="height: 15pt" height="20"&gt;       &lt;td class="xl66" style="border-right: #fac090 0.5pt solid; border-top: medium none; font-weight: 700; font-size: 11pt; background: #fcd5b4; border-left: #fac090 0.5pt solid; color: black; border-bottom: #fac090 0.5pt solid; font-family: calibri; height: 15pt; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #fcd5b4 none" width="310" height="20"&gt;Looked at WF, but didn't use it&lt;/td&gt;        &lt;td class="xl65" style="border-right: #fac090 0.5pt solid; border-top: medium none; font-weight: 400; font-size: 11pt; background: #fcd5b4; border-left: medium none; color: black; border-bottom: #fac090 0.5pt solid; font-family: calibri; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #fcd5b4 none" width="173"&gt;Must attend&lt;/td&gt;        &lt;td class="xl65" style="border-right: #fac090 0.5pt solid; border-top: medium none; font-weight: 400; font-size: 11pt; background: #fcd5b4; border-left: medium none; color: black; border-bottom: #fac090 0.5pt solid; font-family: calibri; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #fcd5b4 none" width="212"&gt;Must attend&lt;/td&gt;        &lt;td class="xl65" style="border-right: #fac090 0.5pt solid; border-top: medium none; font-weight: 400; font-size: 11pt; background: #fcd5b4; border-left: medium none; color: black; border-bottom: #fac090 0.5pt solid; font-family: calibri; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #fcd5b4 none" width="166"&gt;Should attend&lt;/td&gt;     &lt;/tr&gt;      &lt;tr style="height: 15pt" height="20"&gt;       &lt;td class="xl66" style="border-right: #fac090 0.5pt solid; border-top: medium none; font-weight: 700; font-size: 11pt; background: #fde9d9; border-left: #fac090 0.5pt solid; color: black; border-bottom: #fac090 0.5pt solid; font-family: calibri; height: 15pt; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #fde9d9 none" width="310" height="20"&gt;Looked at WCF, but didn't use it&lt;/td&gt;        &lt;td class="xl65" style="border-right: #fac090 0.5pt solid; border-top: medium none; font-weight: 400; font-size: 11pt; background: #fde9d9; border-left: medium none; color: black; border-bottom: #fac090 0.5pt solid; font-family: calibri; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #fde9d9 none" width="173"&gt;Should attend&lt;/td&gt;        &lt;td class="xl65" style="border-right: #fac090 0.5pt solid; border-top: medium none; font-weight: 400; font-size: 11pt; background: #fde9d9; border-left: medium none; color: black; border-bottom: #fac090 0.5pt solid; font-family: calibri; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #fde9d9 none" width="212"&gt;Would enjoy&lt;/td&gt;        &lt;td class="xl65" style="border-right: #fac090 0.5pt solid; border-top: medium none; font-weight: 400; font-size: 11pt; background: #fde9d9; border-left: medium none; color: black; border-bottom: #fac090 0.5pt solid; font-family: calibri; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #fde9d9 none" width="166"&gt;Must attend&lt;/td&gt;     &lt;/tr&gt;      &lt;tr style="height: 15pt" height="20"&gt;       &lt;td class="xl66" style="border-right: #fac090 0.5pt solid; border-top: medium none; font-weight: 700; font-size: 11pt; background: #fcd5b4; border-left: #fac090 0.5pt solid; color: black; border-bottom: #fac090 0.5pt solid; font-family: calibri; height: 15pt; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #fcd5b4 none" width="310" height="20"&gt;Interested in Oslo&lt;/td&gt;        &lt;td class="xl65" style="border-right: #fac090 0.5pt solid; border-top: medium none; font-weight: 400; font-size: 11pt; background: #fcd5b4; border-left: medium none; color: black; border-bottom: #fac090 0.5pt solid; font-family: calibri; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #fcd5b4 none" width="173"&gt;Must attend&lt;/td&gt;        &lt;td class="xl65" style="border-right: #fac090 0.5pt solid; border-top: medium none; font-weight: 400; font-size: 11pt; background: #fcd5b4; border-left: medium none; color: black; border-bottom: #fac090 0.5pt solid; font-family: calibri; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #fcd5b4 none" width="212"&gt;Should attend&lt;/td&gt;        &lt;td class="xl65" style="border-right: #fac090 0.5pt solid; border-top: medium none; font-weight: 400; font-size: 11pt; background: #fcd5b4; border-left: medium none; color: black; border-bottom: #fac090 0.5pt solid; font-family: calibri; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #fcd5b4 none" width="166"&gt;Should attend&lt;/td&gt;     &lt;/tr&gt;      &lt;tr style="height: 15pt" height="20"&gt;       &lt;td class="xl66" style="border-right: #fac090 0.5pt solid; border-top: medium none; font-weight: 700; font-size: 11pt; background: #fde9d9; border-left: #fac090 0.5pt solid; color: black; border-bottom: #fac090 0.5pt solid; font-family: calibri; height: 15pt; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #fde9d9 none" width="310" height="20"&gt;Interested in the problem of coordination&lt;/td&gt;        &lt;td class="xl65" style="border-right: #fac090 0.5pt solid; border-top: medium none; font-weight: 400; font-size: 11pt; background: #fde9d9; border-left: medium none; color: black; border-bottom: #fac090 0.5pt solid; font-family: calibri; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #fde9d9 none" width="173"&gt;Should attend&lt;/td&gt;        &lt;td class="xl65" style="border-right: #fac090 0.5pt solid; border-top: medium none; font-weight: 400; font-size: 11pt; background: #fde9d9; border-left: medium none; color: black; border-bottom: #fac090 0.5pt solid; font-family: calibri; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #fde9d9 none" width="212"&gt;Should attend&lt;/td&gt;        &lt;td class="xl65" style="border-right: #fac090 0.5pt solid; border-top: medium none; font-weight: 400; font-size: 11pt; background: #fde9d9; border-left: medium none; color: black; border-bottom: #fac090 0.5pt solid; font-family: calibri; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #fde9d9 none" width="166"&gt;Should attend&lt;/td&gt;     &lt;/tr&gt;      &lt;tr style="height: 15pt" height="20"&gt;       &lt;td class="xl66" style="border-right: #fac090 0.5pt solid; border-top: medium none; font-weight: 700; font-size: 11pt; background: #fcd5b4; border-left: #fac090 0.5pt solid; color: black; border-bottom: #fac090 0.5pt solid; font-family: calibri; height: 15pt; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #fcd5b4 none" width="310" height="20"&gt;Building services, or apps that consume services&lt;/td&gt;        &lt;td class="xl65" style="border-right: #fac090 0.5pt solid; border-top: medium none; font-weight: 400; font-size: 11pt; background: #fcd5b4; border-left: medium none; color: black; border-bottom: #fac090 0.5pt solid; font-family: calibri; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #fcd5b4 none" width="173"&gt;Would enjoy&lt;/td&gt;        &lt;td class="xl65" style="border-right: #fac090 0.5pt solid; border-top: medium none; font-weight: 400; font-size: 11pt; background: #fcd5b4; border-left: medium none; color: black; border-bottom: #fac090 0.5pt solid; font-family: calibri; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #fcd5b4 none" width="212"&gt;Would enjoy&lt;/td&gt;        &lt;td class="xl65" style="border-right: #fac090 0.5pt solid; border-top: medium none; font-weight: 400; font-size: 11pt; background: #fcd5b4; border-left: medium none; color: black; border-bottom: #fac090 0.5pt solid; font-family: calibri; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #fcd5b4 none" width="166"&gt;Must attend&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Can't wait to see you in LA!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8974616" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mwinkle/archive/tags/wf/default.aspx">wf</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/Oslo/default.aspx">Oslo</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/PDC2008/default.aspx">PDC2008</category></item><item><title>WCF Perf Talk @ PDC (or, the Doctor Teaches Fishing)</title><link>http://blogs.msdn.com/mwinkle/archive/2008/10/02/wcf-perf-talk-pdc-or-the-doctor-teaches-fishing.aspx</link><pubDate>Thu, 02 Oct 2008 17:06:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8973955</guid><dc:creator>mwinkle</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/mwinkle/comments/8973955.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mwinkle/commentrss.aspx?PostID=8973955</wfw:commentRss><description>&lt;p&gt;I'm probably not going to have too much time to attend talks at PDC, but one talk that would be high on my list is the one that Dr. Allen blogs about &lt;a href="http://blogs.msdn.com/drnick/archive/2008/10/02/zen-of-wcf-performance-and-scale.aspx"&gt;here&lt;/a&gt;, where he talks about the Zen of WCF Performance and Scale.&amp;#160; &lt;/p&gt;  &lt;p&gt;I like &amp;quot;Zen&amp;quot; style talks, especially for topics like performance and scale.&amp;#160; Sure, I could go and listen for 75 minutes for tips and tricks that may be applicable to my scenario, but this is giving you a fish.&amp;#160; Having a 75 minute conversation about how to think about perf and scale, how to think about achieving that in a distributed messaging system teaches you how to fish.&amp;#160; This is going to equip you with a lot more knowledge about &lt;em&gt;how&lt;/em&gt; to plan for and solve performance and scale issues down the road.&lt;/p&gt;  &lt;p&gt;This is one lunch session, I wouldn't want to miss.&amp;#160; As a plus, he's taking questions and suggestions on his blog, so fire away!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8973955" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mwinkle/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/PDC2008/default.aspx">PDC2008</category></item><item><title>More Details On WF/WCF in .NET 4.0</title><link>http://blogs.msdn.com/mwinkle/archive/2008/10/01/more-details-on-wf-wcf-in-net-4-0.aspx</link><pubDate>Wed, 01 Oct 2008 20:15:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8972142</guid><dc:creator>mwinkle</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/mwinkle/comments/8972142.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mwinkle/commentrss.aspx?PostID=8972142</wfw:commentRss><description>&lt;p&gt;&lt;a href="http://blogs.msdn.com/stevemar"&gt;Steve Martin&lt;/a&gt;, a director of product management for CSD, has a &lt;a href="http://blogs.msdn.com/stevemar/archive/2008/10/01/the-road-to-pdc-net-framework-4-0-and-dublin.aspx"&gt;blog post&lt;/a&gt; containing more information on the work that we are doing for the next versions of WF and WCF that we will release as a CTP at PDC.&amp;#160; He also introduces &amp;quot;Dublin,&amp;quot; the name for our efforts around creating a manageable and scalable host for WF and WCF applications, something that I know a few customers would be interested in.&amp;#160; &lt;/p&gt;  &lt;p&gt;For you WF and WCF fans, there some more information about some of the features that you'll hear more about at PDC.&amp;#160; I think for customers who are using either today, you'll see something on the list below that gets you interested.&amp;#160; And, if you're not using WF or WCF today, I think there are a few things that might make you interested. We think that the features we're introducing (especially in WF, which is close to my heart) will make it easier to use WF, in more places, and by more people.&amp;#160; Let us know what you think.&amp;#160; What's exciting in the list below, what do you want to hear more about, is there something else you'd like to see on the list? &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;WF Features&lt;/h2&gt;  &lt;p&gt;&lt;b&gt;Significant improvements in performance and scalability&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&amp;#183; Ten-fold improvement in performance&lt;/p&gt;  &lt;p&gt;&lt;b&gt;New workflow flow-control models and pre-built activities&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&amp;#183; Flowcharts, rules&lt;/p&gt;  &lt;p&gt;&amp;#183; Expanded built-in activities &amp;#8211; PowerShell, database, messaging, etc.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Enhancements in workflow modeling&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&amp;#183; Persistence control, transaction flow, compensation support, data binding and scoping&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&amp;#183; Rules composable and seamlessly integrated with workflow engine&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Updated visual designer&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&amp;#183; Easier to use by end-users &lt;/p&gt;  &lt;p&gt;&amp;#183; Easier to rehost by ISVs&lt;/p&gt;  &lt;p&gt;Ability to debug XAML&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;WCF Features&lt;/h2&gt;  &lt;p&gt;&lt;b&gt;RESTful enhancements&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&amp;#183; Simplifying the building of REST Singleton &amp;amp; Collection Services, ATOM Feed and Publishing Protocol Services, and HTTP Plain XML Services using WCF&lt;/p&gt;  &lt;p&gt;&amp;#183; WCF REST Starter Kit to be released on Codeplex to get early feedback&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Messaging enhancements&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&amp;#183; Transports - UDP, MQ, Local in-process &lt;/p&gt;  &lt;p&gt;&amp;#183; Protocols - SOAP over UDP, WS-Discovery, WS-BusinessActivity, WS-I BP 1.2&lt;/p&gt;  &lt;p&gt;&amp;#183; Duplex durable messaging&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Correlation enhancements&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&amp;#183; Content and context driven, One-way support&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Declarative Workflow Services &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&amp;#183; Seamless integration between WF and WCF and unified XAML model&lt;/p&gt;  &lt;p&gt;&amp;#183; Build entire application in XAML, from presentation to data to services to workflow&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8972142" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mwinkle/archive/tags/wf/default.aspx">wf</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/Oslo/default.aspx">Oslo</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/PDC2008/default.aspx">PDC2008</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/Dublin/default.aspx">Dublin</category></item><item><title>More Workflow Service Questions</title><link>http://blogs.msdn.com/mwinkle/archive/2008/08/12/more-workflow-service-questions.aspx</link><pubDate>Tue, 12 Aug 2008 22:06:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8853948</guid><dc:creator>mwinkle</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/mwinkle/comments/8853948.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mwinkle/commentrss.aspx?PostID=8853948</wfw:commentRss><description>&lt;p&gt;In response to this &lt;a href="http://blogs.msdn.com/mwinkle/archive/2008/08/07/q-a-on-advanced-workflow-services-talk.aspx#comments"&gt;post&lt;/a&gt;, &lt;a href="http://theimes.com/"&gt;Anderson&lt;/a&gt; raised the following question.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;Definitely too hard and not service-oriented.&amp;#160; I like the idea of sending it via the headers or some other such implementation, but that would also require implementation on the other side in the form of an agreed-upon place and format of the context information or a custom binding implementation that you either distribute or have the other side of the fence reimplement.&lt;/em&gt;&lt;/p&gt;    &lt;p&gt;&lt;em&gt;The first time I did this I spent days working on it saying to myself &amp;quot;surely you don't have to do this... surely you don't have to tell the target service which *activity* you want it to talk to next&amp;quot;.&amp;#160; But you do.&amp;#160; It makes me sad inside.&lt;/em&gt;&lt;/p&gt;    &lt;p&gt;&lt;strong&gt;matt:&amp;#160; Our general goal is not to introduce more misery into the world.&amp;#160; At this point in time, doing duplex requires the explicit management of the context token.&amp;#160; We're working to make it better, so hopefully around PDC time, you will no longer be sad inside&lt;/strong&gt;.&lt;em&gt;&amp;#160;&lt;/em&gt;&lt;/p&gt;    &lt;p&gt;&lt;em&gt;One thing I've not seen implemented yet in a demo.&amp;#160; I really like the feature of State Machine super states and substates.&amp;#160; The ability to take a group of 3 states and put them in another state called &amp;quot;Cancellable&amp;quot; or some other such interrupty business function is really kickass.&lt;/em&gt;&lt;/p&gt;    &lt;p&gt;&lt;em&gt;Let's say you are in state &amp;quot;Processing&amp;quot; which has an event-driven that listens for the service method &amp;quot;FinishedProcessing&amp;quot;.&amp;#160; &amp;quot;Processing&amp;quot; is also in a superstate called &amp;quot;Cancellable&amp;quot; with an event-driven that listens for &amp;quot;CancelProcess&amp;quot;.&amp;#160; How could you implement this when you have to tell the other service about the context identifier of the target receive activity?&amp;#160; Do you have to send both contexts?&amp;#160; I fear your answer will be yes.&lt;/em&gt;&lt;/p&gt;    &lt;p&gt;&lt;strong&gt;matt:&amp;#160; In that case, provided you are not listening for the same operation in two places, you can get away with grabbing the context token from either FinishedProcessing or CancelProcess and send that along.&amp;#160; The context token will be the same fore either of them, it will only consist of the Workflow Instance Id.&amp;#160; The Instance Id + the OperationName is the combination used to enqueue an inbound message, unless you've gotten clever as in the Conversations sample and told the Receive activities to create queues based on an additional conversation id.&amp;#160; &lt;/strong&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Also, it sounds like Anderson is delivering a talk &lt;a href="http://theimes.com/archive/2008/08/07/d-fw-connected-systems-presentation-august-13th.aspx"&gt;tomorrow night in Dallas about WCF /WF integration&lt;/a&gt;.&amp;#160; If you're in the area, head on over and check it out.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8853948" width="1" height="1"&gt;</description></item><item><title>Advanced Workflow Service Talk (Demo 4 of 4)</title><link>http://blogs.msdn.com/mwinkle/archive/2008/08/11/advanced-workflow-service-talk-demo-4-of-4.aspx</link><pubDate>Mon, 11 Aug 2008 15:52:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8848313</guid><dc:creator>mwinkle</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/mwinkle/comments/8848313.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mwinkle/commentrss.aspx?PostID=8848313</wfw:commentRss><description>&lt;p&gt;When we start doing this two way style of messaging, we now open up to start modeling some interesting business problems.&amp;#160; In the previous post, you'll note that I did not include the code, because I mentioned we needed to be more clever in scenarios where we listen in parallel.&amp;#160; &lt;/p&gt;  &lt;p&gt;First, a brief diversion into how the Receive activity works.&amp;#160; Everybody remembers the workflow queues, the technology that underlies all communication between a host and a workflow instance.&amp;#160; The Receive activity works by creating a queue that the WorkflowServiceHost (specifically the WorkflowOperationInvoker) will use to send the message received off the wire into the workflow.&amp;#160; Now, the Receive activity normally just creates a queue that is named the same as the operation the Receive activity is bound to.&amp;#160; However, if we have two Receive activities listening for the same operation at the same time, no longer is a single queue useful to route responses back as we want to route to the correct Receive activity instance.&amp;#160; &lt;/p&gt;  &lt;p&gt;There is property on the Receive activity called ContextToken.&amp;#160; Normally this is null in the simple case.&amp;#160; However, when we want our Receive activity to operate in parallel, we need to indicate that it needs to be smarter when it creates a queue.&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/AdvancedWorkflowServiceTalkDemo4of4_9005/image_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="227" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/AdvancedWorkflowServiceTalkDemo4of4_9005/image_thumb.png" width="409" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;By setting this property (you can just type in a name, and then select the common owner all of the parallel receive's share.&amp;#160; This will cause the Receive activity to create a queue named [OperationName] +[ConversationId], the conversation ID takes the form of a GUID, and is the second element inside a context token.&amp;#160; &lt;/p&gt;  &lt;p&gt;The sample that I show for this talk is simply the &lt;a href="http://msdn.microsoft.com/en-us/library/bb410775.aspx"&gt;conversations sample inside the SDK&lt;/a&gt;.&amp;#160; This is the sample to check out to understand all sorts of interesting ways to use the context tokens to model your processes.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/bb410775.aspx"&gt;&lt;img alt="Conversations Sample Architecture" src="http://i.msdn.microsoft.com/Bb410775.7f198cc1-b77a-4460-a007-4ac0ac91a109(en-us,VS.90).gif" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Now, there are two conversation patterns here.&amp;#160; One is the one shown above, which I refer to as an &lt;em&gt;n&lt;/em&gt;-party conversation where &lt;em&gt;n&lt;/em&gt; is fixed at design time.&amp;#160; We can accomplish this with the parallel activity.&amp;#160; The other is where &lt;em&gt;n&lt;/em&gt; is arbitrary (imagine you send out to business partners stored in the database).&amp;#160; The way to do this is to use the &lt;a href="http://msdn.microsoft.com/en-us/library/system.workflow.activities.replicatoractivity.aspx"&gt;Replicator&lt;/a&gt; activity.&amp;#160; The Replicator is a little known gem shipped in 3.0 that essentially gives you &amp;quot;ForEach&amp;quot; semantics.&amp;#160; But, by flipping the &lt;a href="http://msdn.microsoft.com/en-us/library/system.workflow.activities.replicatoractivity.executiontype.aspx"&gt;ExecutionType&lt;/a&gt; switch to parallel, I now get the behavior of a parallel, but operating with an arbitrary &lt;em&gt;n&lt;/em&gt; branches. &lt;/p&gt;  &lt;p&gt;So, in order to enable conversations, we need to tell our receive activity to be a little smarter about how it generates its queue name, and then we simply follow the duplex pattern we discussed in the last &lt;a href="http://blogs.msdn.com/mwinkle/archive/2008/08/06/advanced-workflow-services-talk-demo-2-of-4.aspx#comments"&gt;two&lt;/a&gt; &lt;a href="http://blogs.msdn.com/mwinkle/archive/2008/08/07/advanced-workflow-services-talk-demo-3-of-4.aspx"&gt;posts&lt;/a&gt;.&amp;#160; Once we do that, we're in good shape to start modeling some more interesting communication patterns between multiple parties.&amp;#160; &lt;/p&gt;  &lt;h3&gt;Where can we go from here? &lt;/h3&gt;  &lt;p&gt;   &lt;br /&gt;We can just make the patterns more interesting.&amp;#160; One interesting one would be the combination of the long running work with cancellation and a &lt;a href="http://blogs.msdn.com/mwinkle/archive/2007/06/27/implementing-the-n-of-m-pattern-in-wf.aspx"&gt;Voting activity&lt;/a&gt; in order to coordinate the responses and allow for progress to be made when some of the branches complete (if I have 3 yes votes, I can proceed).&amp;#160; The power of building composite activities is that it gives me a uniform programming model (and a single threaded one to boot) in order to handle the coordination of different units of work.&amp;#160; Get out there and write some workflows :-) &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8848313" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mwinkle/archive/tags/wf/default.aspx">wf</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/Orcas/default.aspx">Orcas</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/patterns/default.aspx">patterns</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/presentations/default.aspx">presentations</category></item><item><title>Advanced Workflow Services Talk (Demo 3 of 4)</title><link>http://blogs.msdn.com/mwinkle/archive/2008/08/07/advanced-workflow-services-talk-demo-3-of-4.aspx</link><pubDate>Thu, 07 Aug 2008 21:17:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8841711</guid><dc:creator>mwinkle</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/mwinkle/comments/8841711.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mwinkle/commentrss.aspx?PostID=8841711</wfw:commentRss><description>&lt;p&gt;So, we've seen in part 1 how to manage context, we saw in part 2 how we can take that basic knowledge to do duplex messaging.&amp;#160; Once we start doing duplex work, there are some interesting patterns, and the first one is one that we like to call &amp;quot;long running work&amp;quot;.&amp;#160; Why are we interested in this?&amp;#160; Well, as you probably know, the execution of a workflow is single threaded (this is a feature, not a bug).&amp;#160; We also don't have a mechanism to force the workflow to be &amp;quot;pinned&amp;quot; in memory.&amp;#160; What this means is that things like the asynchronous programming model&amp;#160; (APM), can't be used, since there isn't a guarantee that there will be something to call back when we are done.&amp;#160; What this means is that the send activity can not take advantage of the APM to be more thread friendly.&lt;/p&gt;  &lt;p&gt;We may want to do things in parallel, like this&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/AdvancedWorkflowServicesTalkDemo3of4_D4A0/image_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="309" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/AdvancedWorkflowServicesTalkDemo3of4_D4A0/image_thumb.png" width="616" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;If each of these branches takes 3 seconds, the whole of this workflow will complete in about 9 seconds.&amp;#160; The general expectation is that in parallel, this would happen at the length of the longest branch + some minor delta for overhead.&amp;#160; The trouble is, APM programming is tricky, especially relative to the layout above.&lt;/p&gt;  &lt;p&gt;In order to model APM style service calls, but allowing for the service operations to be extremely long running, where extremely is defined as &amp;quot;long enough to where I would want to be able to persist.&amp;quot;&amp;#160; The approach then is to model this as disjoint send and receive activities.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/AdvancedWorkflowServicesTalkDemo3of4_D4A0/image_4.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="386" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/AdvancedWorkflowServicesTalkDemo3of4_D4A0/image_thumb_1.png" width="632" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;One intermediate step is to simply use one way messaging, but the problem there is that in a lot of cases, I'm looking for some information being sent back to me.&amp;#160; &lt;/p&gt;  &lt;p&gt;I'll hold off on the code for the above, the fact we are listening in parallel for the same operation requires us to be a little more clever. &lt;/p&gt;  &lt;p&gt;Let's look first at our contract, and then our service implementation:&lt;/p&gt;  &lt;div class="csharpcode"&gt;   &lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; Long_Running_Work&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    [ServiceContract]&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;interface&lt;/span&gt; ILongRunningWork&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;        [OperationContract]&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;        &lt;span class="kwrd"&gt;string&lt;/span&gt; TakeAWhile(&lt;span class="kwrd"&gt;int&lt;/span&gt; i);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;        [OperationContract(IsOneWay = &lt;span class="kwrd"&gt;true&lt;/span&gt;)]&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;        &lt;span class="kwrd"&gt;void&lt;/span&gt; OneWayTakeAWhile( &lt;span class="kwrd"&gt;int&lt;/span&gt; i);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;        &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;        [OperationContract(IsOneWay = &lt;span class="kwrd"&gt;true&lt;/span&gt;)]&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;        &lt;span class="kwrd"&gt;void&lt;/span&gt; TakeAWhileAndTellMeLater(IDictionary&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;,&lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt; contextToken, &lt;span class="kwrd"&gt;int&lt;/span&gt; i);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;    }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;    [ServiceContract]&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;interface&lt;/span&gt; IReverseContract&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;    {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;        [OperationContract(IsOneWay = &lt;span class="kwrd"&gt;true&lt;/span&gt;)]&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;        &lt;span class="kwrd"&gt;void&lt;/span&gt; TakeAWhileAndTellMeLaterDone(&lt;span class="kwrd"&gt;string&lt;/span&gt; s);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;    }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;   &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;And now for the implementation of these;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; Long_Running_Work&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;   &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Service1 : ILongRunningWork&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; Service1()&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;        {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;           &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;        }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;        &lt;span class="preproc"&gt;#region&lt;/span&gt; ILongRunningWork Members&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; TakeAWhile(&lt;span class="kwrd"&gt;int&lt;/span&gt; i)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;        {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;            Console.WriteLine(&lt;span class="str"&gt;&amp;quot;Starting TakeAWhile&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;            System.Threading.Thread.Sleep(&lt;span class="kwrd"&gt;new&lt;/span&gt; TimeSpan(0, 0, 3));&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;            &lt;span class="kwrd"&gt;return&lt;/span&gt; i.ToString();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;        }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; OneWayTakeAWhile( &lt;span class="kwrd"&gt;int&lt;/span&gt; i)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;        {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;            Console.WriteLine(&lt;span class="str"&gt;&amp;quot;Starting One Way TakeAWhile&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;            System.Threading.Thread.Sleep(&lt;span class="kwrd"&gt;new&lt;/span&gt; TimeSpan(0, 0, 3));&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;            Console.WriteLine(&lt;span class="str"&gt;&amp;quot;Ending One Way TakeAWhile&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;        }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; TakeAWhileAndTellMeLater(IDictionary&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;, &lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt; context, &lt;span class="kwrd"&gt;int&lt;/span&gt; i)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;        {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;            Console.WriteLine(&lt;span class="str"&gt;&amp;quot;Received the context Token&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;            System.Threading.Thread.Sleep(&lt;span class="kwrd"&gt;new&lt;/span&gt; TimeSpan(0, 0, 3));&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;            Console.WriteLine(&lt;span class="str"&gt;&amp;quot;Need to Message Back Now {0}&amp;quot;&lt;/span&gt;, i.ToString());&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;            &lt;span class="rem"&gt;// could investigate a more useful pooling of these if we &lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;            &lt;span class="rem"&gt;// really wanted to worry about perf&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;            IReverseContractClient ircc = &lt;span class="kwrd"&gt;new&lt;/span&gt; IReverseContractClient(&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  40:  &lt;/span&gt;                &lt;span class="kwrd"&gt;new&lt;/span&gt; NetTcpContextBinding(),&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  41:  &lt;/span&gt;                &lt;span class="kwrd"&gt;new&lt;/span&gt; EndpointAddress(&lt;span class="str"&gt;&amp;quot;net.tcp://localhost:10003/ReverseContract&amp;quot;&lt;/span&gt;)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  42:  &lt;/span&gt;                );&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  43:  &lt;/span&gt;            IContextManager icm = ircc.InnerChannel.GetProperty&amp;lt;IContextManager&amp;gt;();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  44:  &lt;/span&gt;            icm.SetContext(context);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  45:  &lt;/span&gt;            ircc.TakeAWhileAndTellMeLaterDone(i.ToString());&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  46:  &lt;/span&gt;        }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  47:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  48:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  49:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  50:  &lt;/span&gt;        &lt;span class="preproc"&gt;#endregion&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  51:  &lt;/span&gt;    } &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  52:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  53:  &lt;/span&gt;   &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; IReverseContractClient : ClientBase&amp;lt;IReverseContract&amp;gt;, IReverseContract&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  54:  &lt;/span&gt;   {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  55:  &lt;/span&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; IReverseContractClient() : &lt;span class="kwrd"&gt;base&lt;/span&gt;(){}&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  56:  &lt;/span&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; IReverseContractClient(System.ServiceModel.Channels.Binding binding, EndpointAddress address) : &lt;span class="kwrd"&gt;base&lt;/span&gt;(binding, address) { }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  57:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  58:  &lt;/span&gt;&lt;span class="preproc"&gt;#region&lt;/span&gt; IReverseContract Members&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  59:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  60:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  61:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  62:  &lt;/span&gt;       &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; TakeAWhileAndTellMeLaterDone(&lt;span class="kwrd"&gt;string&lt;/span&gt; s)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  63:  &lt;/span&gt;       {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  64:  &lt;/span&gt;           &lt;span class="kwrd"&gt;base&lt;/span&gt;.Channel.TakeAWhileAndTellMeLaterDone(s);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  65:  &lt;/span&gt;       }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  66:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  67:  &lt;/span&gt;       &lt;span class="preproc"&gt;#endregion&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  68:  &lt;/span&gt;   }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  69:  &lt;/span&gt; &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  70:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;Basically, we sit around and wait.&amp;#160; You'll also note in the TakeAWhileAndTellMeLater, we take in a context token (similar to our previous approach), and we will use that to new up a client at the end and call back in after setting the context.&amp;#160; Look at lines 39-44 above.&amp;#160; The nice thing about this is that my above workflow client can actually go idle, persist, and react to a message being delivered later on.&lt;/p&gt;

&lt;p&gt;One thing to note is that one should not place a delay between any of the Send and Receives.&amp;#160; This could cause the workflow to go idle, which may allow you to miss messages.&amp;#160; This is generally considered, a bad thing.&amp;#160; The reason this occurs is that the WorkflowOperationInvoker will use EnqueueOnIdle which means that when teh workflow goes idle, the message will be enqueued.&amp;#160; If the queue hasn't been created by the Receive activity, the message will not get delivered.&lt;/p&gt;

&lt;p&gt;For the final workflow above (the TakeAWhileAndTellMeLater workflow), I will need to spin this up in a WorkflowServiceHost (a la the Duplex Sample in part 2).&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; (WorkflowServiceHost wsh = &lt;span class="kwrd"&gt;new&lt;/span&gt; WorkflowServiceHost(&lt;span class="kwrd"&gt;typeof&lt;/span&gt;(CallLongRunningComponents.WorkflowWithmessaging)))
{
    wsh.AddServiceEndpoint(
            &lt;span class="kwrd"&gt;typeof&lt;/span&gt;(Long_Running_Work.IReverseContract),
            &lt;span class="kwrd"&gt;new&lt;/span&gt; NetTcpContextBinding(),
           &lt;span class="str"&gt;&amp;quot;net.tcp://localhost:10003/ReverseContract&amp;quot;&lt;/span&gt;
            );
    &lt;span class="rem"&gt;// don't forget to open up the wsh&lt;/span&gt;
    WorkflowRuntime wr = wsh.Description.Behaviors.Find&amp;lt;WorkflowRuntimeBehavior&amp;gt;().WorkflowRuntime;

    wsh.Open();


    WorkflowInstance wi = wr.CreateWorkflow(
        &lt;span class="kwrd"&gt;typeof&lt;/span&gt;(CallLongRunningComponents.WorkflowWithmessaging));
    wr.WorkflowCompleted += ((o, e) =&amp;gt; waitHandle.Set());
    wr.WorkflowIdled += ((o, e) =&amp;gt; Console.WriteLine(&lt;span class="str"&gt;&amp;quot;We're idled&amp;quot;&lt;/span&gt;));
        

    wi.Start();




    waitHandle.WaitOne();

}&lt;/pre&gt;
&lt;style type="text/css"&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;Why do I think this is cool? &lt;/p&gt;

&lt;p&gt;Two reasons:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;If I assume that I can modify the called service to callback to me (or put such a wrapper at a runtime service level), this is easier to model than the APM (that code included at the end of this post) &lt;/li&gt;

  &lt;li&gt;This gives me a natural way to start exposing more advanced control over a service call.&amp;#160; Rather than just a send and receive, I can use a send and a listen, and in the listen have a receive, a cancel message receive, and a delay in order to expose more fine grained control points for my workflow, and model the way the process should work very explicitly and declaratively. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/AdvancedWorkflowServicesTalkDemo3of4_D4A0/image_6.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="503" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/AdvancedWorkflowServicesTalkDemo3of4_D4A0/image_thumb_2.png" width="449" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h4&gt;Code for APM approach:&lt;/h4&gt;

&lt;p&gt;call some services and wait:&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;Console.WriteLine(&lt;span class="str"&gt;&amp;quot;Press &amp;lt;enter&amp;gt; to execute APM approach&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;Console.ReadLine();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;waitHandle = &lt;span class="kwrd"&gt;new&lt;/span&gt; AutoResetEvent(&lt;span class="kwrd"&gt;false&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;Stopwatch sw = &lt;span class="kwrd"&gt;new&lt;/span&gt; Stopwatch();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;sw.Start();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;lrwc = &lt;span class="kwrd"&gt;new&lt;/span&gt; WorkflowHost.ServiceReference1.LongRunningWorkClient();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;lrwc.BeginTakeAWhile(1, HandleClientReturn, &lt;span class="str"&gt;&amp;quot;one&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;lrwc.BeginTakeAWhile(2, HandleClientReturn, &lt;span class="str"&gt;&amp;quot;two&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;lrwc.BeginTakeAWhile(3, HandleClientReturn, &lt;span class="str"&gt;&amp;quot;three&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;lrwc.BeginTakeAWhile(4, HandleClientReturn, &lt;span class="str"&gt;&amp;quot;four&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;&lt;span class="kwrd"&gt;while&lt;/span&gt; (!areDone)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;    System.Threading.Thread.Sleep(25);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;}&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;Console.WriteLine(&lt;span class="str"&gt;&amp;quot;APM approach compelted in {0} milliseconds&amp;quot;&lt;/span&gt;, sw.ElapsedMilliseconds);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;Console.WriteLine(&lt;span class="str"&gt;&amp;quot;All Done, press &amp;lt;enter&amp;gt; to exit&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;Console.ReadLine();&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;Ignore the busy wait on line 11, I should use a waithandle here but was having trouble getting it to work correctly (this is hard code).&lt;/p&gt;

&lt;p&gt;The callback and respective state:&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;static&lt;/span&gt; ServiceReference1.LongRunningWorkClient lrwc;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="kwrd"&gt;static&lt;/span&gt; Int32 countOfFinished = 0;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;&lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; HandleClientReturn(IAsyncResult result)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    &lt;span class="kwrd"&gt;string&lt;/span&gt; s = (&lt;span class="kwrd"&gt;string&lt;/span&gt;)result.AsyncState;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;    &lt;span class="kwrd"&gt;string&lt;/span&gt; resultString = lrwc.EndTakeAWhile(result);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;    Console.WriteLine(&lt;span class="str"&gt;&amp;quot;received {0}&amp;quot;&lt;/span&gt;, resultString);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt; (Interlocked.Increment(&lt;span class="kwrd"&gt;ref&lt;/span&gt; countOfFinished) == 4)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;    {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;        areDone = &lt;span class="kwrd"&gt;true&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;    }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;style type="text/css"&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/p&gt;

&lt;p&gt;I have had some people say that line 9 should use &lt;a href="http://msdn.microsoft.com/en-us/library/system.threading.interlocked.compareexchange.aspx"&gt;Interlocked.CompareExchange&lt;/a&gt; in order to do this correctly, but the point is that this is tricky code, that modeling in WF is pretty nice.&amp;#160; [ignoring for the moment the work required to realize the assumption that we can make the service message back.]&amp;#160; &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8841711" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mwinkle/archive/tags/wf/default.aspx">wf</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/Orcas/default.aspx">Orcas</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/presentations/default.aspx">presentations</category></item></channel></rss>