Skip to content

Commit

Permalink
Remove the obsolete ExpressionPrinter.RemoveFormatting
Browse files Browse the repository at this point in the history
  • Loading branch information
AndriySvyryd committed Aug 21, 2019
1 parent e2f974f commit e26a05d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
5 changes: 2 additions & 3 deletions src/EFCore/Infrastructure/ExpressionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ public static class ExpressionExtensions
/// Creates a printable string representation of the given expression.
/// </summary>
/// <param name="expression"> The expression. </param>
/// <param name="removeFormatting"> If true, then internal formatting is removed. </param>
/// <param name="characterLimit"> An optional limit to the number of characters included. </param>
/// <returns> The printable representation. </returns>
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);

/// <summary>
/// Creates a <see cref="MemberExpression"></see> that represents accessing either a field or a property.
Expand Down
15 changes: 2 additions & 13 deletions src/EFCore/Query/ExpressionPrinter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ public ExpressionPrinter()
_encounteredParameters = new List<ParameterExpression>();
}

private bool RemoveFormatting { get; set; }

private int? CharacterLimit { get; set; }

private bool GenerateUniqueParameterIds { get; set; }
Expand Down Expand Up @@ -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)
{
Expand All @@ -137,7 +127,6 @@ protected virtual string PrintCore(
_namelessParameters.Clear();
_encounteredParameters.Clear();

RemoveFormatting = removeFormatting;
CharacterLimit = characterLimit;
GenerateUniqueParameterIds = generateUniqueParameterIds;

Expand Down

0 comments on commit e26a05d

Please sign in to comment.