diff --git a/src/EFCore.Relational/Storage/IRelationalCommandBuilder.cs b/src/EFCore.Relational/Storage/IRelationalCommandBuilder.cs index 002fc9ea641..cc9426cbc22 100644 --- a/src/EFCore.Relational/Storage/IRelationalCommandBuilder.cs +++ b/src/EFCore.Relational/Storage/IRelationalCommandBuilder.cs @@ -53,17 +53,17 @@ public interface IRelationalCommandBuilder /// Appends an object to the command text. /// /// The object to be written. - /// Whether the value should be redacted (i.e. in log). + /// Whether the value is sensitive and should be redacted (i.e. in log). /// The same builder instance so that multiple calls can be chained. - IRelationalCommandBuilder Append(string value, bool redact = false); + IRelationalCommandBuilder Append(string value, bool sensitive = false); /// /// Appends an object to the command text. /// /// The object to be written. - /// Whether the value should be redacted (i.e. in log). + /// Whether the value is sensitive and should be redacted (i.e. in log). /// The same builder instance so that multiple calls can be chained. - IRelationalCommandBuilder Append(FormattableString value, bool redact = false); + IRelationalCommandBuilder Append(FormattableString value, bool sensitive = false); /// /// Appends a blank line to the command text. diff --git a/src/EFCore.Relational/Storage/RelationalCommandBuilder.cs b/src/EFCore.Relational/Storage/RelationalCommandBuilder.cs index 9fc27ad65f6..4fbc4cd185c 100644 --- a/src/EFCore.Relational/Storage/RelationalCommandBuilder.cs +++ b/src/EFCore.Relational/Storage/RelationalCommandBuilder.cs @@ -69,21 +69,21 @@ public virtual IRelationalCommandBuilder RemoveParameterAt(int index) } /// - 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; } /// - 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; } @@ -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) { diff --git a/test/EFCore.SqlServer.FunctionalTests/TestUtilities/TestRelationalCommandBuilderFactory.cs b/test/EFCore.SqlServer.FunctionalTests/TestUtilities/TestRelationalCommandBuilderFactory.cs index 3edadd89ff2..1f8b4bbaa05 100644 --- a/test/EFCore.SqlServer.FunctionalTests/TestUtilities/TestRelationalCommandBuilderFactory.cs +++ b/test/EFCore.SqlServer.FunctionalTests/TestUtilities/TestRelationalCommandBuilderFactory.cs @@ -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); diff --git a/test/EFCore.SqlServer.Tests/Storage/Internal/SqlServerDatabaseCreatorTest.cs b/test/EFCore.SqlServer.Tests/Storage/Internal/SqlServerDatabaseCreatorTest.cs index db2402e8335..ad80ce8d707 100644 --- a/test/EFCore.SqlServer.Tests/Storage/Internal/SqlServerDatabaseCreatorTest.cs +++ b/test/EFCore.SqlServer.Tests/Storage/Internal/SqlServerDatabaseCreatorTest.cs @@ -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);