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

Query: add validation to warn about required navigations pointing to entity with query filter #19801

Closed
maumar opened this issue Feb 4, 2020 · 1 comment · Fixed by #21018
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Milestone

Comments

@maumar
Copy link
Contributor

maumar commented Feb 4, 2020

When model has required navigation which points to the entity, which has query filter we could run into a problematic situation. If the entity is filtered out by query filter we run into referential integrity issue (required entity is not there), so currently we remove the parent entity also. This might be unexpected - we should detect this case during model validation.

Ideally this case would be handled by having a query filter also on the other side of the navigation, effectively filtering out entities whose other side of the navigation has been pruned by it's query filter (soft cascade delete of sorts)

@smitpatel
Copy link
Member

Design meeting decision:

  • We will add a warning in model validation to warn about potential danger of having a query filter defined on principal end without query filter on dependent side when dependent side has non-nullable FK. If FK is non-nullable and principal is filtered out then dependents become orphan which is not something a true non-nullable FK would allow.

@smitpatel smitpatel removed their assignment Feb 14, 2020
maumar added a commit that referenced this issue May 22, 2020
…ons pointing to entity with query filter

Warning is issued for required navigations for which required side has query filter and the optional side doesn't.
When both sides define query filters we assume they are correct, i.e. we don't peek inside the filters to make sure they are consistent.

Fixes #19801
maumar added a commit that referenced this issue May 22, 2020
…ons pointing to entity with query filter

Warning is issued for required navigations for which required side has query filter and the optional side doesn't.
When both sides define query filters we assume they are correct, i.e. we don't peek inside the filters to make sure they are consistent.

Fixes #19801
@maumar maumar added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label May 22, 2020
maumar added a commit that referenced this issue May 22, 2020
…ons pointing to entity with query filter

Warning is issued for required navigations for which required side has query filter and the optional side doesn't.
When both sides define query filters we assume they are correct, i.e. we don't peek inside the filters to make sure they are consistent.

Fixes #19801
@maumar maumar closed this as completed in 46636e0 May 27, 2020
@ajcvickers ajcvickers modified the milestones: 5.0.0, 5.0.0-preview6 Jun 1, 2020
@ajcvickers ajcvickers modified the milestones: 5.0.0-preview6, 5.0.0 Nov 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Projects
None yet
3 participants