Skip to content

Commit d42f2fd

Browse files
Merge pull request #5182 from dotnet/main
Auto Publish – main to live - 2025-11-25 23:00 UTC
2 parents 69e84a8 + f6f589a commit d42f2fd

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

entity-framework/core/what-is-new/ef-core-10.0/breaking-changes.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ This page documents API and behavior changes that have the potential to break ex
2929
| [Complex type column names are now uniquified](#complex-type-column-uniquification) | Low |
3030
| [Nested complex type properties use full path in column names](#nested-complex-type-column-names) | Low |
3131
| [IDiscriminatorPropertySetConvention signature changed](#discriminator-convention-signature) | Low |
32+
| [IRelationalCommandDiagnosticsLogger methods add logCommandText parameter](#logger-logcommandtext) | Low |
3233

3334
## Low-impact changes
3435

@@ -363,6 +364,45 @@ public virtual void ProcessDiscriminatorPropertySet(
363364
IConventionContext<IConventionProperty> context)
364365
```
365366

367+
<a name="logger-logcommandtext"></a>
368+
369+
### IRelationalCommandDiagnosticsLogger methods add logCommandText parameter
370+
371+
[Tracking Issue #35757](https://github.com/dotnet/efcore/issues/35757)
372+
373+
#### Old behavior
374+
375+
Previously, methods on `IRelationalCommandDiagnosticsLogger` such as `CommandReaderExecuting`, `CommandReaderExecuted`, `CommandScalarExecuting`, and others accepted a `command` parameter representing the database command being executed.
376+
377+
#### New behavior
378+
379+
Starting with EF Core 10.0, these methods now require an additional `logCommandText` parameter. This parameter contains the SQL command text that will be logged, which may have sensitive data redacted when <xref:Microsoft.EntityFrameworkCore.DbContextOptionsBuilder.EnableSensitiveDataLogging> is not enabled.
380+
381+
#### Why
382+
383+
This change supports the new feature to [redact inlined constants from logging by default](xref:core/what-is-new/ef-core-10.0/whatsnew#redact-inlined-constants-from-logging-by-default). When EF inlines parameter values into SQL (e.g., when using `EF.Constant()`), those values are now redacted from logs unless sensitive data logging is explicitly enabled. The `logCommandText` parameter provides the redacted SQL for logging purposes, while the `command` parameter contains the actual SQL that gets executed.
384+
385+
#### Mitigations
386+
387+
If you have a custom implementation of `IRelationalCommandDiagnosticsLogger`, you'll need to update your method signatures to include the new `logCommandText` parameter. For example:
388+
389+
```c#
390+
public InterceptionResult<DbDataReader> CommandReaderExecuting(
391+
IRelationalConnection connection,
392+
DbCommand command,
393+
DbContext context,
394+
Guid commandId,
395+
Guid connectionId,
396+
DateTimeOffset startTime,
397+
string logCommandText) // New parameter
398+
{
399+
// Use logCommandText for logging purposes
400+
// Use command for execution-related logic
401+
}
402+
```
403+
404+
The `logCommandText` parameter contains the SQL to be logged (with inlined constants potentially redacted), while `command.CommandText` contains the actual SQL that will be executed against the database.
405+
366406
<a name="MDS-breaking-changes"></a>
367407

368408
## Microsoft.Data.Sqlite breaking changes

0 commit comments

Comments
 (0)