Пример #1
0
        private bool TryGetCompiledExpressionRootAtDesignTime(Activity expression, Activity target, out ICompiledExpressionRoot compiledExpressionRoot, out int exprId)
        {
            exprId = -1;
            compiledExpressionRoot = null;
            if (!CompiledExpressionInvoker.TryGetCompiledExpressionRoot(expression, target, out compiledExpressionRoot) ||
                !CanExecuteExpression(compiledExpressionRoot, out exprId))
            {
                return(FindCompiledExpressionRoot(out exprId, out compiledExpressionRoot));
            }

            return(true);
        }
Пример #2
0
        private bool TryGetCurrentCompiledExpressionRoot(ActivityContext activityContext, out ICompiledExpressionRoot compiledExpressionRoot, out int expressionId)
        {
            var current = activityContext.CurrentInstance;

            while (current != null && current.Activity != this.metadataRoot)
            {
                if (CompiledExpressionInvoker.TryGetCompiledExpressionRoot(current.Activity, true, out var currentCompiledExpressionRoot))
                {
                    if (CanExecuteExpression(currentCompiledExpressionRoot, out expressionId))
                    {
                        compiledExpressionRoot = currentCompiledExpressionRoot;
                        return(true);
                    }
                }
                current = current.Parent;
            }

            compiledExpressionRoot = null;
            expressionId           = -1;

            return(false);
        }
Пример #3
0
        private bool FindCompiledExpressionRoot(out int exprId, out ICompiledExpressionRoot compiledExpressionRoot)
        {
            var root = this.metadata.CurrentActivity.Parent;

            while (root != null)
            {
                if (CompiledExpressionInvoker.TryGetCompiledExpressionRoot(metadata.CurrentActivity, root, out var currentCompiledExpressionRoot))
                {
                    if (CanExecuteExpression(currentCompiledExpressionRoot, out exprId))
                    {
                        compiledExpressionRoot = currentCompiledExpressionRoot;
                        return(true);
                    }
                }
                root = root.Parent;
            }

            exprId = -1;
            compiledExpressionRoot = null;

            return(false);
        }