-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Deletion can cause error "The association between entity types A and B has been severed..." #30122
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Milestone
Comments
Note for triage: looks like a regression when entities deleted due to changes in one relationship are then also severed by changes in another relationship. @edwiles Workaround is to call |
Thanks @ajcvickers , that workaround is working for our real code. Would appreciate a fix when you can. |
ajcvickers
added a commit
that referenced
this issue
Jan 31, 2023
…inished Fixes #30122 Because the entities for which the relationship is being severed may end up being deleted later on in SaveChanges.
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
When multiple cascade paths have been avoided by setting one path to
DeleteBehavior.Restrict
, deletion can fail with the error:The code below runs successfully with EF Core 6.0.13, but fails with 7.0.0-7.0.2.
Steps to reproduce
.csproj
file that uses EF Core 6.Model.cs
:Program.cs
:The program returns successfully, without output.
.csproj
file to upgrade to EF Core 7:The program execution fails with the error:
Further technical details
EF Core version: 7.0.2
.NET SDK: 7.0.100
Database Provider: Microsoft.EntityFrameworkCore.Sqlite (though in our "real" code we use SqlServer)
Operating system: Windows 10 Enterprise
IDE: Visual Studio 17.4.2
The text was updated successfully, but these errors were encountered: