-
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
Use shared-type entity types instead of entity types with defining navigation. #23586
Conversation
@@ -322,11 +253,6 @@ public virtual void UpdateIsKeylessConfigurationSource(ConfigurationSource confi | |||
return newBaseType; | |||
} | |||
|
|||
if (HasDefiningNavigation()) |
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.
Does this enable former entity type with defining navigations to have hierarchy?
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.
Technically you can specify a base type for a STET, but we don't have Fluent API for it, nor support
?? (entityType.HasSharedClrType | ||
? entityType.FindOwnership() is ForeignKey ownership | ||
? FindActualEntityType(ownership.PrincipalEntityType) | ||
?.FindNavigation(ownership.PrincipalToDependent!.Name)?.TargetEntityType |
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.
💡 If FK has flag for ownership then may be can annotate that PrincipalToDependent is non-null when flag is true.
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.
Do you know how?
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.
[CA.MemberNotNullWhen(false, nameof(Arguments), nameof(ArgumentsPropagateNullability))] |
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.
If I put [CA.MemberNotNullWhen(true, nameof(PrincipalToDependent))]
on IsOwnership
it doesn't help even if I use entityType.GetForeignKeys().FirstOrDefault(fk => fk.IsOwnership)
instead of entityType.FindOwnership
. I don't think the compiler is smart enough
test/EFCore.InMemory.FunctionalTests/Query/ComplexNavigationsSharedQueryInMemoryTest.cs
Outdated
Show resolved
Hide resolved
…vigation. They should behave mostly the same, except that DefiningEntityType and DefiningNavigationName will return true and Name will return what FullName returned previously Fixes #22378
4246590
to
3d31f53
Compare
They should behave mostly the same, except that
DefiningEntityType
andDefiningNavigationName
will returnnull
andName
will return whatFullName
returned previously.Fixes #22378