internal static WorkflowVariableBase ConvertContent(WorkflowVariable workflowVariable) { return((WorkflowVariableBase)JsonConvert.DeserializeObject( workflowVariable.Content, KeyBuilder.FromKey(workflowVariable.Type) )); }
internal void AddVariable(WorkflowVariableBase variable) { var type = KeyBuilder.ToKey(variable.GetType()); var existing = this.WorkflowVariables.FirstOrDefault(v => v.Type == type); if (existing != null) { existing.UpdateContent(variable); return; } this.WorkflowVariables.Add(WorkflowVariable.Create(this, variable)); }
private void EnsureWorkflowVariables(Workflow workflow, TriggerParam param) { if (workflow.WorkflowVariables.Count == 0) { return; } foreach (var workflowVariable in workflow.WorkflowVariables) { var variable = WorkflowVariable.ConvertContent(workflowVariable); if (variable is WorkflowVariableBase) { var key = workflowVariable.Type; if (param.Variables.ContainsKey(key)) { param.Variables[key] = variable as WorkflowVariableBase; } else { param.Variables.Add(key, variable as WorkflowVariableBase); } } } }