-
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
Add ForeignKeyConstraint to the relational model. #20141
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also update your images from presentation to demonstrate where do ForeignKeyConstraint fit in those charts.
case DeleteBehavior.ClientNoAction: | ||
return ReferentialAction.NoAction; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this wrong? The store should restrict.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤷
@ajcvickers Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did this PR change this? (I don't remember the mappings off the top of my head.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ajcvickers No, this is what we have right now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then it's probably what we decided. Whether or not it is "correct" is a different question.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TLDR: It doesn't matter
It's a bit confusing (as expected): for EF ReferentialAction.NoAction
means use the database default and in most databases NoAction
is the default. In most databases NoAction
doesn't mean that no error is thrown, it means that the error is delayed until the transaction is committed. Also in SQL Server there's no Restrict
.
EF currently doesn't support deleting and inserting the same (principal) row in a single transaction, so NoAction
and Restrict
are equivalent, but if we ever do then NoAction
would be better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine to leave as is for now, but I want to do a deep review of these. I remember Diego and I really wanted to break something here.
I don't think it's worth it, it's mostly |
Part of #12846