Beispiel #1
0
        public IExecutionContext CreateChild(Guid recordId, string displayName, string refName, string scopeName, string contextName, Dictionary <string, string> intraActionState = null, int?recordOrder = null)
        {
            Trace.Entering();

            var child = new ExecutionContext();

            child.Initialize(HostContext);
            child.ScopeName   = scopeName;
            child.ContextName = contextName;
            child.Features    = Features;
            child.Variables   = Variables;
            child.Endpoints   = Endpoints;
            child.Plan        = Plan;
            if (intraActionState == null)
            {
                child.IntraActionState = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);
            }
            else
            {
                child.IntraActionState = intraActionState;
            }
            child.EnvironmentVariables = EnvironmentVariables;
            child.JobDefaults          = JobDefaults;
            child.Scopes       = Scopes;
            child.FileTable    = FileTable;
            child.StepsContext = StepsContext;
            foreach (var pair in ExpressionValues)
            {
                child.ExpressionValues[pair.Key] = pair.Value;
            }
            foreach (var item in ExpressionFunctions)
            {
                child.ExpressionFunctions.Add(item);
            }
            child._cancellationTokenSource = new CancellationTokenSource();
            child.WriteDebug = WriteDebug;
            child._parentExecutionContext = this;
            child.PrependPath             = PrependPath;
            child.Container           = Container;
            child.ServiceContainers   = ServiceContainers;
            child.EchoOnActionCommand = EchoOnActionCommand;

            if (recordOrder != null)
            {
                child.InitializeTimelineRecord(_mainTimelineId, recordId, _record.Id, ExecutionContextType.Task, displayName, refName, recordOrder);
            }
            else
            {
                child.InitializeTimelineRecord(_mainTimelineId, recordId, _record.Id, ExecutionContextType.Task, displayName, refName, ++_childTimelineRecordOrder);
            }

            child._logger = HostContext.CreateService <IPagingLogger>();
            child._logger.Setup(_mainTimelineId, recordId);

            return(child);
        }
        public IExecutionContext CreateChild(Guid recordId, string displayName, string refName, string scopeName, string contextName, ActionRunStage stage, Dictionary <string, string> intraActionState = null, int?recordOrder = null, IPagingLogger logger = null, bool isEmbedded = false, CancellationTokenSource cancellationTokenSource = null, Guid embeddedId = default(Guid), string siblingScopeName = null)
        {
            Trace.Entering();

            var child = new ExecutionContext();

            child.Initialize(HostContext);
            child.Global           = Global;
            child.ScopeName        = scopeName;
            child.ContextName      = contextName;
            child.Stage            = stage;
            child.EmbeddedId       = embeddedId;
            child.SiblingScopeName = siblingScopeName;
            child.JobTelemetry     = JobTelemetry;
            if (intraActionState == null)
            {
                child.IntraActionState = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);
            }
            else
            {
                child.IntraActionState = intraActionState;
            }
            foreach (var pair in ExpressionValues)
            {
                child.ExpressionValues[pair.Key] = pair.Value;
            }
            foreach (var item in ExpressionFunctions)
            {
                child.ExpressionFunctions.Add(item);
            }
            child._cancellationTokenSource = cancellationTokenSource ?? new CancellationTokenSource();
            child._parentExecutionContext  = this;
            child.EchoOnActionCommand      = EchoOnActionCommand;

            if (recordOrder != null)
            {
                child.InitializeTimelineRecord(_mainTimelineId, recordId, _record.Id, ExecutionContextType.Task, displayName, refName, recordOrder);
            }
            else
            {
                child.InitializeTimelineRecord(_mainTimelineId, recordId, _record.Id, ExecutionContextType.Task, displayName, refName, ++_childTimelineRecordOrder);
            }
            if (logger != null)
            {
                child._logger = logger;
            }
            else
            {
                child._logger = HostContext.CreateService <IPagingLogger>();
                child._logger.Setup(_mainTimelineId, recordId);
            }

            child.IsEmbedded = isEmbedded;

            return(child);
        }