bool IResumableActivity.OnStart(IRunState context, ActivityInputs inputs) { Workflow workflowToProxy; using (CustomContext.SetContext(context.EffectiveSecurityContext)) { workflowToProxy = ActivityInstance.As <WorkflowProxy>().WorkflowToProxy; } var wfArgs = workflowToProxy.As <WfActivity>().GetInputArguments().Select(arg => arg.Name); // copy across matching arguments. Arguments that are supplied that are not used are ignored. var matchingInputs = inputs.Where(kvp => wfArgs.Contains(kvp.Key.Name)).ToDictionary(kvp => kvp.Key.Name, kvp => kvp.Value); if (inputs.Count != matchingInputs.Count) // We have some mismatched parameters { var expected = String.Join(", ", wfArgs); var actual = String.Join(", ", inputs.Select(i => i.Key.Name)); throw new WorkflowRunException($"Mismatched inputs to workflow. (Have the proxied workflows inputs changed?)\n Expected: {expected}\n Actual: {actual}"); } context.WorkflowInvoker.PostEvent(new ChildWorkflowStartEvent(workflowToProxy, matchingInputs, context.WorkflowRun)); // note, we always rely on the resume for handling the completion. return(false); }
public override void Validate(WorkflowMetadata metadata) { base.Validate(metadata); var workflowToProxy = ActivityInstance.As <WorkflowProxy>().WorkflowToProxy; if (workflowToProxy == null) { metadata.AddValidationError("Workflow to run has not been set."); } // // The proxy workflow will be validated separately // }