mirror of
https://github.com/fergalmoran/EFCore.NamingConventions.git
synced 2025-12-22 01:28:13 +00:00
@@ -88,10 +88,11 @@ public class NameRewritingConvention :
|
|||||||
var ownedEntityType = foreignKey.DeclaringEntityType;
|
var ownedEntityType = foreignKey.DeclaringEntityType;
|
||||||
|
|
||||||
// An entity type is becoming owned - this is a bit complicated.
|
// An entity type is becoming owned - this is a bit complicated.
|
||||||
// Unless it's a collection navigation, or the owned entity table name was explicitly set by the user, this triggers table
|
// This is a trigger for table splitting - unless the foreign key is non-unique (collection navigation), it's JSON ownership,
|
||||||
// splitting, which means we need to undo rewriting which we've done previously.
|
// or the owned entity table name was explicitly set by the user.
|
||||||
|
// If this is table splitting, we need to undo rewriting which we've done previously.
|
||||||
if (foreignKey.IsOwnership
|
if (foreignKey.IsOwnership
|
||||||
&& !foreignKey.GetNavigation(false)!.IsCollection
|
&& (foreignKey.IsUnique || !string.IsNullOrEmpty(ownedEntityType.GetContainerColumnName()))
|
||||||
&& ownedEntityType.GetTableNameConfigurationSource() != ConfigurationSource.Explicit)
|
&& ownedEntityType.GetTableNameConfigurationSource() != ConfigurationSource.Explicit)
|
||||||
{
|
{
|
||||||
// Reset the table name which we've set when the entity type was added.
|
// Reset the table name which we've set when the entity type was added.
|
||||||
|
|||||||
Reference in New Issue
Block a user