Beispiel #1
0
        /// <summary>
        /// Clones the <see cref="EvaluationContext"/> and returns a new one that contains the new variable.
        /// </summary>
        private EvaluationContext GetScopeLocalContext(EvaluationContext ctx)
        {
            var variable = new EvaluationVariable(
                evalAsync: () => Value.Evaluate(ctx),
                selectResolver: () => Value.ComputeSelect(ctx),
                pathsResolver: () => Value.ComputePaths(ctx));

            var ctxClone = ctx.Clone();

            ctxClone.SetLocalVariable(VariableName, variable);

            return(ctxClone);
        }
        /// <summary>
        /// Clones the <see cref="EvaluationContext"/> and returns a new one that contains the new variable.
        /// </summary>
        private EvaluationContext GetScopeLocalContext(EvaluationContext ctx)
        {
            _varExpression ??= TemplexBase.Parse(VariableExpression);

            var variable = new EvaluationVariable(
                evalAsync: () => _varExpression.Evaluate(ctx),
                selectResolver: () => _varExpression.ComputeSelect(ctx),
                pathsResolver: () => _varExpression.ComputePaths(ctx));

            var ctxClone = ctx.Clone();

            ctxClone.SetLocalVariable(VariableName, variable);

            return(ctxClone);
        }