diff --git a/src/EFCore/Metadata/Internal/InternalForeignKeyBuilder.cs b/src/EFCore/Metadata/Internal/InternalForeignKeyBuilder.cs index 3da2fdeeaf0..b27dd1c66ec 100644 --- a/src/EFCore/Metadata/Internal/InternalForeignKeyBuilder.cs +++ b/src/EFCore/Metadata/Internal/InternalForeignKeyBuilder.cs @@ -973,6 +973,12 @@ private static bool IsCompatible( Metadata.DeclaringEntityType.Model.ScopedModelDependencies?.Logger.AmbiguousEndRequiredWarning(Metadata); } + if (AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue26611", out var enabled) && enabled) + { + Metadata.SetIsRequired(required, configurationSource); + return this; + } + IConventionForeignKey? foreignKey = Metadata; var result = Metadata.DeclaringEntityType.Model.ConventionDispatcher.Track( () => Metadata.SetIsRequired(required, configurationSource), ref foreignKey);