Beispiel #1
0
        public void CanWriteFormattedText()
        {
            string expected = "<ul>\n\t<li>\n\t\t1 + 2 = 3\n\t</li>\n</ul>";

            var writer = new SqlWriter();
            writer.AppendLine("<ul>");
                writer.Indent();
                    writer.AppendLine("<li>");
                        writer.Indent();
                            writer.AppendLine("1", "+", "2", "=", "3");
                        writer.Unindent();
                    writer.AppendLine("</li>");
                writer.Unindent();
            writer.AppendLine("</ul>");

            var result = writer.GetResult();
            Assert.AreEqual(expected, result);
        }
Beispiel #2
0
        public void Render(SqlWriter writer)
        {
            if (_joins.Count == 0)
                return;

            foreach (var join in _joins.Values)
            {
                writer.AppendLine();
                join.Render(writer);
            }
        }
Beispiel #3
0
        public void Render(SqlWriter writer)
        {
            writer.AppendLine(SqlStrings.Select);

            writer.Indent();

            writer.AppendLine(Top);

            writer.AppendLine(Columns);

            writer.Unindent();

            writer.AppendLine(From);

            writer.AppendLine(JoinGroup);

            writer.AppendLine(Where);

            writer.AppendLine(OrderBy);
        }
Beispiel #4
0
        public void Render(SqlWriter writer)
        {
            writer.AppendLine(SqlStrings.Select);

            writer.Indent();

            writer.AppendLine(Top);

            writer.AppendLine("*");

            writer.Unindent();

            writer.AppendLine(SqlStrings.From, "(");

            writer.Indent();

            writer.AppendLine(_innerSelect);

            writer.Unindent();

            writer.AppendLine(")", SqlStrings.As, _alias);

            writer.AppendLine(SqlStrings.Where, (BracketedName)SqlStrings.ROW_NUMBER, ">", _skip.ParamName);
        }
Beispiel #5
0
 public void Render(SqlWriter writer)
 {
     writer.AppendLine(SqlStrings.From, _select.EntityMap.Schema + _select.EntityMap.Table, SqlStrings.As, _select.Alias, SqlStrings.NoLock);
 }
Beispiel #6
0
 public void Render(SqlWriter writer)
 {
     writer.Append(Join, ReferenceMap.To.Table, SqlStrings.As, ToAlias, SqlStrings.NoLock);
     writer.Indent();
     writer.AppendLine(SqlStrings.On, FromAlias + ReferenceMap.Column, "=", ToAlias + ReferenceMap.To.Key.Column);
     writer.Unindent();
 }
Beispiel #7
0
 public void Render(SqlWriter writer)
 {
     writer.AppendLine(SqlStrings.Where);
     expr.Render(writer);
 }