private IDictionary <string, IExpression> GetEvaluationExpressions(MustacheConfigSchema schema)
        {
            var evalExpressions = new Dictionary <string, IExpression>();

            foreach (var calculatedParam in schema.CalculatedParams)
            {
                IExpression expression = null;
                switch (calculatedParam.ExpressionType)
                {
                case ExpressionTypeEnum.Any:
                    expression = new AnyExpression(_logger, calculatedParam, schema);
                    break;

                case ExpressionTypeEnum.Bool:
                    expression = new BooleanExpression(_logger, calculatedParam, schema);
                    break;

                case ExpressionTypeEnum.Case:
                    expression = new CaseExpression(_logger, calculatedParam, schema);
                    break;

                case ExpressionTypeEnum.String:
                    expression = new CaseExpression(_logger, calculatedParam, schema);
                    break;

                case ExpressionTypeEnum.MoreThanOne:
                    expression = new MoreThanOneExpression(_logger, calculatedParam, schema);
                    break;

                default:
                    throw new InvalidEnumArgumentException("Calculated Expression", (int)calculatedParam.ExpressionType, typeof(ExpressionTypeEnum));
                }

                if (expression != null)
                {
                    evalExpressions.Add(calculatedParam.Name, expression);
                }
            }

            return(evalExpressions);
        }
예제 #2
0
 private List <InclusionExpression> GetInclusionExpressions(Dictionary <string, string> dataView,
                                                            MustacheConfigSchema schema) =>
 schema.ConditionalInclusions
 .Select(x => new InclusionExpression(