diff --git a/src/EFCore/Infrastructure/ExpressionExtensions.cs b/src/EFCore/Infrastructure/ExpressionExtensions.cs
index 44dde942e5e..efc797c9aa0 100644
--- a/src/EFCore/Infrastructure/ExpressionExtensions.cs
+++ b/src/EFCore/Infrastructure/ExpressionExtensions.cs
@@ -30,11 +30,10 @@ public static class ExpressionExtensions
/// Creates a printable string representation of the given expression.
///
/// The expression.
- /// If true, then internal formatting is removed.
/// An optional limit to the number of characters included.
/// The printable representation.
- public static string Print([NotNull] this Expression expression, bool removeFormatting = false, int? characterLimit = null)
- => new ExpressionPrinter().Print(Check.NotNull(expression, nameof(expression)), removeFormatting, characterLimit);
+ public static string Print([NotNull] this Expression expression, int? characterLimit = null)
+ => new ExpressionPrinter().Print(Check.NotNull(expression, nameof(expression)), characterLimit);
///
/// Creates a that represents accessing either a field or a property.
diff --git a/src/EFCore/Query/ExpressionPrinter.cs b/src/EFCore/Query/ExpressionPrinter.cs
index ad5221fd824..ac0f30717e3 100644
--- a/src/EFCore/Query/ExpressionPrinter.cs
+++ b/src/EFCore/Query/ExpressionPrinter.cs
@@ -51,8 +51,6 @@ public ExpressionPrinter()
_encounteredParameters = new List();
}
- private bool RemoveFormatting { get; set; }
-
private int? CharacterLimit { get; set; }
private bool GenerateUniqueParameterIds { get; set; }
@@ -105,30 +103,22 @@ public virtual ExpressionPrinter AppendLines([NotNull] object o, bool skipFinalN
private void AppendLine([NotNull] string message)
{
- if (RemoveFormatting)
- {
- _stringBuilder.Append(string.IsNullOrEmpty(message) ? " " : message);
- }
-
_stringBuilder.AppendLine(message);
}
public virtual string Print(
Expression expression,
- bool removeFormatting = false,
int? characterLimit = null)
- => PrintCore(expression, removeFormatting, characterLimit, generateUniqueParameterIds: false);
+ => PrintCore(expression, characterLimit, generateUniqueParameterIds: false);
public virtual string PrintDebug(
Expression expression,
- bool removeFormatting = false,
int? characterLimit = null,
bool generateUniqueParameterIds = true)
- => PrintCore(expression, removeFormatting, characterLimit, generateUniqueParameterIds);
+ => PrintCore(expression, characterLimit, generateUniqueParameterIds);
protected virtual string PrintCore(
Expression expression,
- bool removeFormatting,
int? characterLimit,
bool generateUniqueParameterIds)
{
@@ -137,7 +127,6 @@ protected virtual string PrintCore(
_namelessParameters.Clear();
_encounteredParameters.Clear();
- RemoveFormatting = removeFormatting;
CharacterLimit = characterLimit;
GenerateUniqueParameterIds = generateUniqueParameterIds;