-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Variable names must be unique within a query batch or stored procedure #26632
Comments
Same here since upgrading from 5 to 6. |
Is this fixed in the latest EF Core 6.0.0 for sql-server? |
@mahyar1386 The fix will be included in the 6.0.1 patch, as indicated by the milestone. The fix is already included in the latest daily build. |
@ajcvickers I'm not seeing any 6.0.1-* builds in the dotnet6 or dotnet7 nuget repositories, can you clarify how we can get the fix for this issue; also, is there an estimate for when 6.0.1 will be available? |
To temporarily work around this issue until the release of 6.0.1 is made available, I set the MaxBatchSize to 1 in the Sql Server configuration for EF. |
@failwyn Unfortunately, patches are not included in the daily builds. The 7.0.0 builds contain this fix. The patch is scheduled for release in the coming days. |
For anyone else struggling with this, @andy-clymer's workaround worked for us as well. Add |
FYI for those impacted by this issue: EF Core 6.0.1 is now available from NuGet. |
Description
There is an issue when adding new entities of different types to the context and calling save changes at the end when one entity only has a single record to add and another entity has more than two records to add. I followed a variation of this example to produce the issue, and have included the demo application for reproducing the problem.
Problem Code Snippet
Stack trace
Exception: An error occurred while saving the entity changes. See the inner exception for details.
Inner Exception: The variable name '@instered0' has already been declared. Variable names must be unique withing a query batch or stored procedure.
Include provider and version information
EF Core version: 6.0.0
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 6.0
Operating system: Windows 11 Pro
IDE: Visual Studio Enterprise 2022 (64-bit) 17.0.0
Sample.Api.zip
The text was updated successfully, but these errors were encountered: