Skip to content

Stop deleting orphans for optional relationships configured for cascade deletes#27557

Merged
ajcvickers merged 1 commit intomainfrom
TinyTimForTheWin0302
Mar 11, 2022
Merged

Stop deleting orphans for optional relationships configured for cascade deletes#27557
ajcvickers merged 1 commit intomainfrom
TinyTimForTheWin0302

Conversation

@ajcvickers
Copy link
Contributor

Fixes #27217
Fixes #27218

The 5.0/6.0 behavior here is:

  • Orphans are deleted if the relationship is severed by navigation property
  • Orphans are not deleted if the relationship is severed by setting the FK to null

This change means orphans are not deleted in either case. The change that causes this to happen is to not set a conceptual null for a nullable FK property. Deletion can still be forced by explicitly forcing a conceptual null or just by setting the dependent state explicitly to Deleted.

…de deletes

Fixes #27217
Fixes #27218

The 5.0/6.0 behavior here is:
- Orphans are deleted if the relationship is severed by navigation property
- Orphans are not deleted if the relationship is severed by setting the FK to null

This change means orphans are not deleted in either case. The change that causes this to happen is to not set a conceptual null for a nullable FK property. Deletion can still be forced by explicitly forcing a conceptual null or just by setting the dependent state explicitly to Deleted.
@ajcvickers ajcvickers merged commit a061538 into main Mar 11, 2022
@ajcvickers ajcvickers deleted the TinyTimForTheWin0302 branch March 11, 2022 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants