Skip to content
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

On Delete Behavior Documentation Concern #2645

Closed
MGhandour92 opened this issue Sep 15, 2020 · 3 comments
Closed

On Delete Behavior Documentation Concern #2645

MGhandour92 opened this issue Sep 15, 2020 · 3 comments

Comments

@MGhandour92
Copy link

MGhandour92 commented Sep 15, 2020

I can't see the difference between [Restrict, NoAction], I think there is a mistake in the documentation. Which one will make no effect when deleting the parent Entity?

I want to know which option will leave the data with no change, and what is the difference between the options with Client prefix?


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@ajcvickers
Copy link
Contributor

There is no practical difference between Restrict and NoAction. Some databases may choose when to check constraints differently, but that should rarely have any functional impact.

Duplicate of #473

@MGhandour92
Copy link
Author

Forget the difference, it is not right what is written:

"the values of foreign key properties in dependent entities are set to null when the related principal is deleted"
"If a property cannot be set to null because it is not a nullable type, then an exception will be thrown when SaveChanges() is called."

NoAction or Restrict, should leave the dependent entities' value

@ajcvickers
Copy link
Contributor

@MGhandour92 In what specific situation do you not want EF to change the FK value and why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants