Ejemplo n.º 1
0
 internal static WorkflowVariableBase ConvertContent(WorkflowVariable workflowVariable)
 {
     return((WorkflowVariableBase)JsonConvert.DeserializeObject(
                workflowVariable.Content,
                KeyBuilder.FromKey(workflowVariable.Type)
                ));
 }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        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);
                    }
                }
            }
        }