I have a workflow service host. In workflow service, I have an activity ExecuteCounterActivity
public sealed class ExecuteCounterActivity : CodeActivity
{
// If your activity returns a value, derive from CodeActivity<TResult>
// and return the value from the Execute method.
protected override void Execute(CodeActivityContext context)
{
var workflowInstanceId = context.WorkflowInstanceId;
var workflowApplication = new WorkflowApplication(new CounterActivity());
workflowApplication.Run();
}
}
the workflow instanceid = "06DD16A5-D4B2-4907-A6FF-CA6021E66D75" when I get by code: context.WorkflowInstanceId
In ExecuteCounterActivity , I new a Workflow application CounterActivity. Therefore, in CounterActivity. I get workflowInstaceId, it will return a new instance Id: "444FEC86-62C1-4AAC-A857-9B9559051E63"
My expectation: the workflow instanceId in CounterActivity is same as with instanceId in ExecuteCounterActivity.
For now, I don't have any solution for that, so can someone show me the solution for resolving my issue ?
You may try a diferent approach, using composition activities or scheduling it like:
protected override void Execute(CodeActivityContext context)
{
context.ScheduleActivity(new CounterActivity());
}