Example #1
0
        protected override void Execute(NativeActivityContext context)
        {
            Logger.Debug("InvokeChildWorkflow -> Start");

            var id = InvokeWorkflow(context.WorkflowInstanceId, WorkflowCode.Get(context), Domain.Get(context), Properties.Get(context), Async.Get(context));

            NewWorkflowId.Set(context, id);
            WorkflowId.Set(context, id);

            if (!Async.Get(context))
            {
                context.ScheduleActivity(_sync, OnChildWorkflowCompleteCallback);
            }

            Logger.Debug("InvokeChildWorkflow -> End");
        }
        private string GetWorkflowXaml(NativeActivityContext context)
        {
            var workflowCode = WorkflowCode.Get(context);

            if (ActivityHelpers.UseActivityStackTrace(context))
            {
                var tracking = new CustomTrackingRecord(DisplayName);
                tracking.Data.Add("WorkflowCode", string.Format("Workflow='{0}'", workflowCode));
                context.Track(tracking);
            }

            if (string.IsNullOrEmpty(workflowCode))
            {
                throw new OperationException("WorkflowCode is null.");
            }

            if (_wfCache.ContainsKey(workflowCode))
            {
                return(_wfCache[workflowCode]);
            }

            _wfCache[workflowCode] = ActivityHelpers.GetWorkflowXaml(workflowCode);
            return(_wfCache[workflowCode]);
        }