1
votes

I'm investigating Workflow Foundation and would like some clarification.

Is a single Workflow Type still bound to a single WorkFlow Service as seems to be the case in WF3?

Or can a Workflow Host/Workflow Host Factory (or something similar) be used in front of the Workflow Service that takes a Workflow Type as a parameter?

My scenario is that we would have multiple workflows that are different for each customer. Each workflow would start the same but by selecting the customer from the client the different workflows are called. Rather than hardcoding calls to multiple Workflow Services for each new customer I was hoping it would be as simple as adding a new Workflow Activity to a class library and adding the workflow name to the customer record in the database. (It wouldn't be this simple but I think this explains the concept).

Cheers

1

1 Answers

1
votes

In WF 4.0 a Workflow Service is a Workflow definition that exposes a service contract through WCF. So yes, a Workflow Service is still directly coupled to a Workflow type.

In your case I would probably define a facade service contract with a single operation that maps directly to the business process implemented by the workflows. The request would contain a token that uniquely identifies the customer for which the process should be started. The service implementation, then, would logically do one of two things:

  1. Start the workflow for the requesting customer
  2. Start an orchestrating workflow passing on the customer identification token. This workflow will then branch out to the customer specific workflows when appropriate.

The 2) approach makes a lot of sense if part of the business process is the same across customers. Furthermore, nothing prevents you from storing the customer specific XAML workflow definitions in a database and load them at runtime from the orchestrating workflow.