Beispiel #1
0
        /// <summary>
        /// Create a new instance of the <see cref="TemplatePlanIf"/> class.
        /// </summary>
        public TemplatePlanIf(string conditionExpression, TemplatePlan inner)
        {
            if (inner is null)
            {
                throw new ArgumentNullException(nameof(inner));
            }

            if (string.IsNullOrWhiteSpace(conditionExpression))
            {
                throw new ArgumentException($"'{nameof(conditionExpression)}' cannot be null or whitespace.", nameof(conditionExpression));
            }

            Inner = inner;
            ConditionExpression = conditionExpression;
        }
        /// <summary>
        /// Create a new instance of the <see cref="TemplatePlanForeach"/> class.
        /// </summary>
        /// <param name="iteratorVarName">The name of the variable to add to the context with each iteration.</param>
        /// <param name="listExpression">The list expression to loop over.</param>
        /// <param name="inner">The inner plan subject to this <see cref="TemplatePlanForeach"/>.</param>
        public TemplatePlanForeach(string iteratorVarName, string listExpression, TemplatePlan inner)
        {
            if (inner is null)
            {
                throw new ArgumentNullException(nameof(inner));
            }

            if (string.IsNullOrWhiteSpace(iteratorVarName))
            {
                throw new ArgumentException($"'{nameof(iteratorVarName)}' cannot be null or whitespace.", nameof(iteratorVarName));
            }

            TemplexVariable.ValidateVariableName(iteratorVarName);

            if (string.IsNullOrWhiteSpace(listExpression))
            {
                throw new ArgumentException($"'{nameof(listExpression)}' cannot be null or whitespace.", nameof(listExpression));
            }

            Inner = inner;
            IteratorVariableName = iteratorVarName;
            ListExpression       = listExpression;
        }
        /// <summary>
        /// Create a new instance of the <see cref="TemplatePlanDefineQuery"/> class.
        /// </summary>
        /// <param name="varName">The name of the variable to add to the context.</param>
        /// <param name="queryInfo">The <see cref="QueryInfo"/> to assign to the variable.</param>
        /// <param name="inner">The inner plan subject to this <see cref="TemplatePlanDefineQuery"/>.</param>
        public TemplatePlanDefineQuery(string varName, QueryInfo queryInfo, TemplatePlan inner)
        {
            if (inner is null)
            {
                throw new ArgumentNullException(nameof(inner));
            }

            if (string.IsNullOrWhiteSpace(varName))
            {
                throw new ArgumentException($"'{nameof(varName)}' cannot be null or whitespace.", nameof(varName));
            }

            if (queryInfo is null)
            {
                throw new ArgumentNullException(nameof(queryInfo));
            }

            TemplexVariable.ValidateVariableName(varName);

            Inner        = inner;
            VariableName = varName;
            QueryInfo    = queryInfo;
        }
        /// <summary>
        /// Create a new instance of the <see cref="TemplatePlanDefine"/> class.
        /// </summary>
        /// <param name="varName">The name of the variable to add to the context.</param>
        /// <param name="varExpression">The expression to assign to the variable.</param>
        /// <param name="inner">The inner plan subject to this <see cref="TemplatePlanDefine"/>.</param>
        public TemplatePlanDefine(string varName, string varExpression, TemplatePlan inner)
        {
            if (inner is null)
            {
                throw new ArgumentNullException(nameof(inner));
            }

            if (string.IsNullOrWhiteSpace(varName))
            {
                throw new ArgumentException($"'{nameof(varName)}' cannot be null or whitespace.", nameof(varName));
            }

            TemplexVariable.ValidateVariableName(varName);

            if (string.IsNullOrWhiteSpace(varExpression))
            {
                throw new ArgumentException($"'{nameof(varExpression)}' cannot be null or whitespace.", nameof(varExpression));
            }

            Inner              = inner;
            VariableName       = varName;
            VariableExpression = varExpression;
        }