I have a bunch of named value parameters in a Dictionary<string, object>
, which I want to pass into different workflows. The catch is that each workflow will only need a subset of the properties in the dictionary, and I don't know beforehand which workflow needs which properties.
The problem is that when I call WorkflowRuntime.CreateWorkflow with the dictionary to bind with, it fails with:
The activity '<workflow name>' has no public writable property named '<property name>'
I know what this means. The property in the workflow is not defined because this particular workflow does not need that particular property (other workflows might).
Is there anyway to bind a dictionary to workflow properties, and IGNORE properties that are not defined on the workflow?
-
Why don't you pass your dictionary into the workflow instances? Your workflow definitions then just have to have a property for that dictionary.
var inputs = Dictionary<string, YOUR_CUSTOM_TYPE>(); // ... // fill your dictionary according to the context // ... var inputParams = new Dictionary<string, object>(); inputParams["WF_PROP_NAME"] = inputs; var wfInstance = wfRuntime.CreateWorkflow(WF_TYPE, inputParams);
This way your workflows just get the dictionary items of interest from the dictionary.
0 comments:
Post a Comment