views:

287

answers:

2

Normally, the method of passing workflow parameters to the workflow happens in the call to RunWorkflow. However, with the WorkflowServiceHost, there is no such method call involved. You simply call the Open() method on the instance. Any ideas?

Of course, the implication is that I add more parameters to the service contract, but these parameters are not relevant for the consumers of the service. They are more like configuration values.

A: 

I believe the WorkflowServiceHost is a re-hosting of the WorkflowRuntime that has been wrapped for you and not really an activity that would parameters associated with it. Typically, you define your data contract that you are going to use with your ReceiveActivity and the data members of that contract represent the parameters you are going to use within the workflow.

MattK
Understood, but there are parameters (or configuration values) that I would like to establish for every workflow instance, and not for message received. I do not want those values to be part of the service contract.
dpurrington
Perhaps you could use the DependencyProperty.RegisterAttached method to inject some properties?
MattK
A: 

So far, I've determined it is possible under some circumstances. If the workflow is started by the host, parameters can be passed. However, if a ReceiveActivity causes the workflow to be created (CanCreateInstance is set to True), then it appears that you cannot.

dpurrington