示例#1
0
        private IDictionary <int, WorkflowExecutionScope> DeserializeScopes(JToken token, WorkflowTokenizationContext context)
        {
            var scopeLookup = new Dictionary <int, WorkflowExecutionScope>();
            var scopeModels = token["scopes"] ?? new JArray();

            foreach (var scopeModel in scopeModels)
            {
                var scope           = new WorkflowExecutionScope();
                var scopeId         = scopeModel["id"].Value <int>();
                var variableModels  = (JArray)scopeModel["variables"];
                var lastResultModel = scopeModel["lastResult"];
                var lastResult      = tokenizerInvoker.Detokenize(context, lastResultModel);

                foreach (var variableModel in variableModels)
                {
                    var variableName       = variableModel["name"].Value <string>();
                    var variableValueModel = variableModel["value"];
                    var variableValue      = tokenizerInvoker.Detokenize(context, variableValueModel);

                    scope.Variables.Add(variableName, variableValue);
                }

                scope.LastResult = lastResult;
                scopeLookup.Add(scopeId, scope);
            }

            return(scopeLookup);
        }
示例#2
0
 public Workflow()
 {
     Scope = new WorkflowExecutionScope();
     BlockingActivities = new HashSet <IActivity>();
     ExecutionLog       = new List <LogEntry>();
 }