From 88fe0e89e776f2ef8432a46bcb44154676cd0637 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 27 Jun 2026 00:49:56 +0000 Subject: [PATCH 1/2] Apply remaining changes --- .../ef-core-10.0/breaking-changes.md | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/entity-framework/core/what-is-new/ef-core-10.0/breaking-changes.md b/entity-framework/core/what-is-new/ef-core-10.0/breaking-changes.md index 0c50fec2d8..a3ae3280ac 100644 --- a/entity-framework/core/what-is-new/ef-core-10.0/breaking-changes.md +++ b/entity-framework/core/what-is-new/ef-core-10.0/breaking-changes.md @@ -31,6 +31,7 @@ This page documents API and behavior changes that have the potential to break ex | [Nested complex type properties use full path in column names](#nested-complex-type-column-names) | Low | | [IDiscriminatorPropertySetConvention signature changed](#discriminator-convention-signature) | Low | | [IRelationalCommandDiagnosticsLogger methods add logCommandText parameter](#logger-logcommandtext) | Low | +| [SQL parameter names are now simplified](#simplified-parameter-names) | Low | ## Medium-impact changes @@ -459,6 +460,44 @@ public InterceptionResult CommandReaderExecuting( 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. + + +### SQL parameter names are now simplified + +[Tracking Issue #35200](https://github.com/dotnet/efcore/pull/35200) + +#### Old behavior + +Previously, EF generated SQL parameter names with a `__` prefix and a trailing counter. For example, a query referencing a `city` variable produced a parameter named `@__city_0`: + +```sql +@__city_0='London' + +SELECT [b].[Id], [b].[Name] +FROM [Blogs] AS [b] +WHERE [b].[City] = @__city_0 +``` + +#### New behavior + +Starting with EF Core 10.0, parameter names are simplified to match the originating variable or member name, and a numeric suffix is only added when needed to make a name unique. The same query now produces a parameter named `@city`: + +```sql +@city='London' + +SELECT [b].[Id], [b].[Name] +FROM [Blogs] AS [b] +WHERE [b].[City] = @city +``` + +#### Why + +The previous `__` prefix and unconditional counter made the generated SQL harder to read in logs, query plans, and diagnostic output. The simplified names more closely resemble SQL that a developer would write by hand and make it easier to correlate parameters with the variables in your code. + +#### Mitigations + +This change is transparent for most applications, since EF manages parameter names internally and the executed queries are functionally identical. However, code that depends on the exact parameter names in the generated SQL - such as snapshot tests comparing SQL text, or interceptors and loggers that parse `DbCommand.CommandText` or inspect `DbParameter.ParameterName` - needs to be updated to account for the new names. + ## Microsoft.Data.Sqlite breaking changes From e3215dad963a04918415f43f91974b58cb5f6f70 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 30 Jun 2026 20:28:31 +0000 Subject: [PATCH 2/2] Address SQL parameter docs feedback --- .../core/what-is-new/ef-core-10.0/breaking-changes.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/entity-framework/core/what-is-new/ef-core-10.0/breaking-changes.md b/entity-framework/core/what-is-new/ef-core-10.0/breaking-changes.md index a3ae3280ac..bff4e83ec0 100644 --- a/entity-framework/core/what-is-new/ef-core-10.0/breaking-changes.md +++ b/entity-framework/core/what-is-new/ef-core-10.0/breaking-changes.md @@ -464,7 +464,7 @@ The `logCommandText` parameter contains the SQL to be logged (with inlined const ### SQL parameter names are now simplified -[Tracking Issue #35200](https://github.com/dotnet/efcore/pull/35200) +[Tracking Issue #35196](https://github.com/dotnet/efcore/issues/35196) #### Old behavior @@ -498,6 +498,8 @@ The previous `__` prefix and unconditional counter made the generated SQL harder This change is transparent for most applications, since EF manages parameter names internally and the executed queries are functionally identical. However, code that depends on the exact parameter names in the generated SQL - such as snapshot tests comparing SQL text, or interceptors and loggers that parse `DbCommand.CommandText` or inspect `DbParameter.ParameterName` - needs to be updated to account for the new names. +Since parameter names are part of the generated SQL text, upgrading may also cause almost all cached query plans to be recompiled on the database server. Large systems should account for a temporary compilation spike immediately after deployment while those plans are rebuilt. + ## Microsoft.Data.Sqlite breaking changes