public override IEnumerable <SyntaxNodeOrToken> ChildNodesAndTokens()
        {
            yield return(WithKeyword);

            foreach (var nodeOrToken in CommonTableExpressions.GetWithSeparators())
            {
                yield return(nodeOrToken);
            }

            yield return(Query);
        }
Ejemplo n.º 2
0
        private string GetSql()
        {
            var result = string.Empty;

            if (CommonTableExpressions.Any())
            {
                result += "; WITH ";
            }

            foreach (var cte in CommonTableExpressions)
            {
                result += string.Format("\n\n{0} AS (\n{1}\n) /* {0} */ ,", cte.Alias, cte.SelectQuery.Sql);
            }

            result = result.TrimEnd(',');

            result += "\n\n" + SelectQuery.Sql;

            return(result);
        }