Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions src/EFCore.Relational/Storage/IRelationalCommandBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ public interface IRelationalCommandBuilder
/// Appends an object to the command text.
/// </summary>
/// <param name="value">The object to be written.</param>
/// <param name="redact">Whether the value should be redacted (i.e. in log).</param>
/// <param name="sensitive">Whether the value is sensitive and should be redacted (i.e. in log).</param>
/// <returns>The same builder instance so that multiple calls can be chained.</returns>
IRelationalCommandBuilder Append(string value, bool redact = false);
IRelationalCommandBuilder Append(string value, bool sensitive = false);

/// <summary>
/// Appends an object to the command text.
/// </summary>
/// <param name="value">The object to be written.</param>
/// <param name="redact">Whether the value should be redacted (i.e. in log).</param>
/// <param name="sensitive">Whether the value is sensitive and should be redacted (i.e. in log).</param>
/// <returns>The same builder instance so that multiple calls can be chained.</returns>
IRelationalCommandBuilder Append(FormattableString value, bool redact = false);
IRelationalCommandBuilder Append(FormattableString value, bool sensitive = false);

/// <summary>
/// Appends a blank line to the command text.
Expand Down
16 changes: 8 additions & 8 deletions src/EFCore.Relational/Storage/RelationalCommandBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,21 @@ public virtual IRelationalCommandBuilder RemoveParameterAt(int index)
}

/// <inheritdoc />
public virtual IRelationalCommandBuilder Append(string value, bool redact = false)
public virtual IRelationalCommandBuilder Append(string value, bool sensitive = false)
{
InitializeLogCommandTextBuilderIfNeeded(redact);
InitializeLogCommandTextBuilderIfNeeded(sensitive);
_commandTextBuilder.Append(value);
_logCommandTextBuilder?.Append(redact ? "?" : value);
_logCommandTextBuilder?.Append(sensitive ? "?" : value);

return this;
}

/// <inheritdoc />
public virtual IRelationalCommandBuilder Append(FormattableString value, bool redact = false)
public virtual IRelationalCommandBuilder Append(FormattableString value, bool sensitive = false)
{
InitializeLogCommandTextBuilderIfNeeded(redact);
InitializeLogCommandTextBuilderIfNeeded(sensitive);
_commandTextBuilder.Append(value);
_logCommandTextBuilder?.Append(redact ? $"?" : value);
_logCommandTextBuilder?.Append(sensitive ? $"?" : value);

return this;
}
Expand Down Expand Up @@ -119,9 +119,9 @@ public virtual IRelationalCommandBuilder DecrementIndent()
public virtual int CommandTextLength
=> _commandTextBuilder.Length;

private void InitializeLogCommandTextBuilderIfNeeded(bool redact)
private void InitializeLogCommandTextBuilderIfNeeded(bool sensitive)
{
if (redact
if (sensitive
&& _logCommandTextBuilder is null
&& !Dependencies.LoggingOptions.IsSensitiveDataLoggingEnabled)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ public IRelationalCommand Build()
Instance.ToString(),
Parameters);

public IRelationalCommandBuilder Append(string value, bool redact = false)
public IRelationalCommandBuilder Append(string value, bool sensitive = false)
{
Instance.Append(value);

return this;
}

public IRelationalCommandBuilder Append(FormattableString value, bool redact = false)
public IRelationalCommandBuilder Append(FormattableString value, bool sensitive = false)
{
Instance.Append(value);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,14 @@ public IRelationalTypeMappingSource TypeMappingSource
public IRelationalCommand Build()
=> new FakeRelationalCommand();

public IRelationalCommandBuilder Append(string value, bool redact = false)
public IRelationalCommandBuilder Append(string value, bool sensitive = false)
{
Instance.Append(value);

return this;
}

public IRelationalCommandBuilder Append(FormattableString value, bool redact = false)
public IRelationalCommandBuilder Append(FormattableString value, bool sensitive = false)
{
Instance.Append(value);

Expand Down