diff --git a/src/EFCore/Metadata/Internal/InternalTypeBaseBuilder.cs b/src/EFCore/Metadata/Internal/InternalTypeBaseBuilder.cs index b9ab85070bb..24333f89885 100644 --- a/src/EFCore/Metadata/Internal/InternalTypeBaseBuilder.cs +++ b/src/EFCore/Metadata/Internal/InternalTypeBaseBuilder.cs @@ -15,6 +15,9 @@ namespace Microsoft.EntityFrameworkCore.Metadata.Internal; public abstract class InternalTypeBaseBuilder : AnnotatableBuilder, IConventionTypeBaseBuilder { + private static readonly bool UseOldBehavior34201 = + AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue34201", out var enabled34201) && enabled34201; + /// /// 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 @@ -204,6 +207,7 @@ public static bool IsCompatible(MemberInfo? newMemberInfo, PropertyBase existing || (memberInfo is PropertyInfo propertyInfo && propertyInfo.IsIndexerProperty())) { if (existingProperty.GetTypeConfigurationSource() is ConfigurationSource existingTypeConfigurationSource + && (typeConfigurationSource != null || UseOldBehavior34201) && !typeConfigurationSource.Overrides(existingTypeConfigurationSource)) { return null; diff --git a/test/EFCore.Relational.Tests/Migrations/Internal/MigrationsModelDifferTest.cs b/test/EFCore.Relational.Tests/Migrations/Internal/MigrationsModelDifferTest.cs index b0f732c5b56..aa91709aaec 100644 --- a/test/EFCore.Relational.Tests/Migrations/Internal/MigrationsModelDifferTest.cs +++ b/test/EFCore.Relational.Tests/Migrations/Internal/MigrationsModelDifferTest.cs @@ -8646,7 +8646,7 @@ public void Split_out_subtype_with_seed_data() x.Property("Name"); x.Property("Discriminator"); - x.HasDiscriminator("Discriminator") + x.HasDiscriminator() .HasValue(1) .HasValue(2);