Building A New Mouse Trap V: Workflow

Monday, November 28, 2005
Windows Workflow Designer

When I first heard about Windows Workflow Foundation, I wasn’t particularly excited. “Workflow” has long been a buzzword used by vendors, product managers, and venture capitalists in mind numbing phrases like: “Our workflow solution will leverage your strategic business assets and put you in the fast lane of the information superhighway”.


Nevertheless, I knew some people who were taking Workflow seriously, so I decided to give the preview bits  a try. Workflow is a success. The designer works well – both the user interface and the programming interface are intuitive. For a good description of the feature set, which includes state machine workflows and long running workflows, see David Chappell’s “Introducing Windows Workflow Foundation”.

Here is a code activity that Workflow invokes. It would be nice if the Parameters turned into strongly typed properties.

private void Fetch_ExecuteCode(object sender, EventArgs e)


  FetchSettings settings = new FetchSettings();

  settings.ConnectionString = Parameters["ConnectionString"].Value as string;

  settings.LocalDataPath = Parameters["LocalDataPath"].Value as string;


  // ...


  FetchProcessor processor;

  processor = new FetchProcessorFactory.GetConfiguredFetchProcessor(settings);

  _files = processor.Process();          


To kick off a workflow...

private void StartImport()


  if (!workflow.IsStarted)



    workflow.WorkflowCompleted +=

           new EventHandler<WorkflowCompletedEventArgs>


    workflow.WorkflowTerminated +=

           new EventHandler<WorkflowTerminatedEventArgs>





  Type importType = typeof(ImportWorkflow);


  Dictionary<string, object> parameters = new Dictionary<string, object>();

  // ...

  parameters.Add("LocalDataPath", Path.GetTempPath());

  parameters.Add("ConnectionString", Settings.Default.wfStatsConnectionString);


  workflow.StartWorkflow(importType, parameters);           


Comments are now closed.
My Pluralsight Courses
The Podcast!