Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose basic IndentedStringBuilder API on ExpressionPrinter #16749

Merged
merged 1 commit into from
Jul 25, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 44 additions & 2 deletions src/EFCore/Query/ExpressionPrinter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,51 @@ public virtual void VisitList<T>(
}
}

private void Append([NotNull] string message) => _stringBuilder.Append(message);
public virtual ExpressionPrinter Append([NotNull] object o)
{
_stringBuilder.Append(o);
return this;
}

private void Append([NotNull] int value) => _stringBuilder.Append(value);
public virtual ExpressionPrinter AppendLine()
{
_stringBuilder.AppendLine();
return this;
}

public virtual ExpressionVisitor AppendLine([NotNull] object o)
{
_stringBuilder.AppendLine(o);
return this;
}

public virtual ExpressionPrinter AppendLines([NotNull] object o, bool skipFinalNewline = false)
{
_stringBuilder.AppendLines(o, skipFinalNewline);
return this;
}

public virtual ExpressionPrinter IncrementIndent()
{
_stringBuilder.IncrementIndent();
return this;
}

public virtual ExpressionPrinter IncrementIndent(bool connectNode)
{
_stringBuilder.IncrementIndent(connectNode);
return this;
}

public virtual ExpressionPrinter DecrementIndent()
{
_stringBuilder.DecrementIndent();
return this;
}

public virtual IDisposable Indent() => _stringBuilder.Indent();

private void Append([NotNull] string message) => _stringBuilder.Append(message);

private void AppendLine([NotNull] string message = "")
{
Expand Down