-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Throw if identifying foreign key is still unknown when saving changes
Fixes #13666 Investigated this in more detail. Two `Object` (this is a custom `Object` class, not the normal `System.Object` type) entities are created. The first one is directly associated with a Container. The second one has no Container reference or FK set. However, because the FK is also part of the PK, and the PK uses generated values, it means that the FK gets a value set. We do this to handle dependents encountered before principals when attaching the graph. But the intention here is that the dummy key value generated will be replaced once the principal is attached. If this doesn't happen, then SaveChanges will throw due to the FK constraint violation. This change provides clarity by failing in SaveChanges so we avoid ever sending the dummy value to the database.
- Loading branch information
1 parent
d5ead04
commit b5efa4b
Showing
5 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters