diff --git a/src/EFCore/Metadata/Conventions/ForeignKeyPropertyDiscoveryConvention.cs b/src/EFCore/Metadata/Conventions/ForeignKeyPropertyDiscoveryConvention.cs
index 7fae234a577..beb97f2b1b1 100644
--- a/src/EFCore/Metadata/Conventions/ForeignKeyPropertyDiscoveryConvention.cs
+++ b/src/EFCore/Metadata/Conventions/ForeignKeyPropertyDiscoveryConvention.cs
@@ -50,6 +50,9 @@ public class ForeignKeyPropertyDiscoveryConvention :
IPropertyFieldChangedConvention,
IModelFinalizingConvention
{
+ private static readonly bool UseOldBehavior35110 =
+ AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue35110", out var enabled) && enabled;
+
///
/// Creates a new instance of .
///
@@ -81,7 +84,8 @@ private IConventionForeignKeyBuilder ProcessForeignKey(
IConventionContext context)
{
var shouldBeRequired = true;
- if (!relationshipBuilder.Metadata.IsOwnership)
+ if (!relationshipBuilder.Metadata.IsOwnership
+ || UseOldBehavior35110)
{
foreach (var property in relationshipBuilder.Metadata.Properties)
{
diff --git a/src/EFCore/Metadata/Internal/InternalEntityTypeBuilder.cs b/src/EFCore/Metadata/Internal/InternalEntityTypeBuilder.cs
index 58c607bc23e..53d96998377 100644
--- a/src/EFCore/Metadata/Internal/InternalEntityTypeBuilder.cs
+++ b/src/EFCore/Metadata/Internal/InternalEntityTypeBuilder.cs
@@ -15,6 +15,9 @@ namespace Microsoft.EntityFrameworkCore.Metadata.Internal;
///
public class InternalEntityTypeBuilder : InternalTypeBaseBuilder, IConventionEntityTypeBuilder
{
+ private static readonly bool UseOldBehavior35110 =
+ AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue35110", out var enabled) && enabled;
+
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
@@ -3171,8 +3174,12 @@ public static InternalIndexBuilder DetachIndex(Index indexToDetach)
+ "Owned types should only have ownership or ownee navigations point at it");
relationship = relationship.IsOwnership(true, configurationSource)
- ?.HasNavigations(inverse, navigation, configurationSource)
- ?.IsRequired(true, configurationSource);
+ ?.HasNavigations(inverse, navigation, configurationSource);
+
+ if (!UseOldBehavior35110)
+ {
+ relationship = relationship?.IsRequired(true, configurationSource);
+ }
relationship?.Metadata.UpdateConfigurationSource(configurationSource);
return relationship;