예제 #1
0
        public static LanguageInterpolatedQuery LanguageInterpolateStroke(this VisitedQuery query, LanguageInterpolator languageInterpolator)
        {
            languageInterpolator = languageInterpolator ?? new LanguageInterpolator();

            var r = languageInterpolator.Proceed(query);

            return(r);
        }
        internal LanguageInterpolatedQuery Proceed(VisitedQuery query)
        {
            QueryStructureText = query.QueryStructure;
            Expressions        = query.Arguments.ToDictionary(x => x.Position);
            StringBuilder result = new StringBuilder();

            for (int i = 0; i < QueryStructureText.Length; i++)
            {
                if (Expressions.ContainsKey(i))
                {
                    result.Append(Visit(Expressions[i]));
                }
                else
                {
                    result.Append(QueryStructureText[i]);
                }
            }

            return(new LanguageInterpolatedQuery(result.ToString(), _parameters.ToArray(), query.UsedTypes));
        }