From 22c52f003afb54d850e9141e4d1364c666f01766 Mon Sep 17 00:00:00 2001 From: AndriySvyryd Date: Wed, 12 Jun 2019 16:48:29 -0700 Subject: [PATCH] Allow removing the discriminator for entity types that are not part of a hierarchy. Part of #12086 --- azure-pipelines.yml | 9 ++- .../Metadata/Builders/EntityTypeBuilder.cs | 33 +++++---- .../Metadata/Builders/EntityTypeBuilder`.cs | 14 ++-- src/EFCore/Metadata/Internal/EntityType.cs | 16 +++-- .../Internal/InternalEntityTypeBuilder.cs | 70 +++++++++---------- .../Metadata/CosmosBuilderExtensionsTest.cs | 27 +++++++ .../BackingFieldConventionTest.cs | 3 +- .../BaseTypeDiscoveryConventionTest.cs | 3 +- .../CascadeDeleteConventionTest.cs | 2 +- .../ConstructorBindingConventionTest.cs | 3 +- .../ConventionDispatcherTest.cs | 2 +- .../DerivedTypeDiscoveryConventionTest.cs | 3 +- .../DiscriminatorConventionTest.cs | 5 +- .../EntityTypeAttributeConventionTest.cs | 3 +- .../ForeignKeyIndexConventionTest.cs | 2 +- ...reignKeyPropertyDiscoveryConventionTest.cs | 3 +- .../KeyDiscoveryConventionTest.cs | 3 +- .../ModelCleanupConventionTest.cs | 3 +- .../NavigationAttributeConventionTest.cs | 3 +- .../NonNullableNavigationConventionTest.cs | 3 +- ...NullableReferencePropertyConventionTest.cs | 3 +- .../PropertyAttributeConventionTest.cs | 3 +- .../PropertyDiscoveryConventionTest.cs | 3 +- ...PropertyMappingValidationConventionTest.cs | 2 +- .../RelationshipDiscoveryConventionTest.cs | 3 +- .../ServicePropertyDiscoveryConventionTest.cs | 3 +- .../ValueGeneratorConventionTest.cs | 3 +- .../Internal/InternalEntityTypeBuilderTest.cs | 2 +- 28 files changed, 148 insertions(+), 84 deletions(-) rename test/EFCore.Tests/Metadata/Conventions/{Internal => }/BackingFieldConventionTest.cs (99%) rename test/EFCore.Tests/Metadata/Conventions/{Internal => }/BaseTypeDiscoveryConventionTest.cs (96%) rename test/EFCore.Tests/Metadata/Conventions/{Internal => }/CascadeDeleteConventionTest.cs (98%) rename test/EFCore.Tests/Metadata/Conventions/{Internal => }/ConstructorBindingConventionTest.cs (99%) rename test/EFCore.Tests/Metadata/Conventions/{Internal => }/ConventionDispatcherTest.cs (99%) rename test/EFCore.Tests/Metadata/Conventions/{Internal => }/DerivedTypeDiscoveryConventionTest.cs (96%) rename test/{EFCore.Relational.Tests/Metadata/Conventions/Internal => EFCore.Tests/Metadata/Conventions}/DiscriminatorConventionTest.cs (97%) rename test/EFCore.Tests/Metadata/Conventions/{Internal => }/EntityTypeAttributeConventionTest.cs (95%) rename test/EFCore.Tests/Metadata/Conventions/{Internal => }/ForeignKeyIndexConventionTest.cs (96%) rename test/EFCore.Tests/Metadata/Conventions/{Internal => }/ForeignKeyPropertyDiscoveryConventionTest.cs (99%) rename test/EFCore.Tests/Metadata/Conventions/{Internal => }/KeyDiscoveryConventionTest.cs (98%) rename test/EFCore.Tests/Metadata/Conventions/{Internal => }/ModelCleanupConventionTest.cs (97%) rename test/EFCore.Tests/Metadata/Conventions/{Internal => }/NavigationAttributeConventionTest.cs (99%) rename test/EFCore.Tests/Metadata/Conventions/{Internal => }/NonNullableNavigationConventionTest.cs (99%) rename test/EFCore.Tests/Metadata/Conventions/{Internal => }/NonNullableReferencePropertyConventionTest.cs (97%) rename test/EFCore.Tests/Metadata/Conventions/{Internal => }/PropertyAttributeConventionTest.cs (99%) rename test/EFCore.Tests/Metadata/Conventions/{Internal => }/PropertyDiscoveryConventionTest.cs (98%) rename test/EFCore.Tests/Metadata/Conventions/{Internal => }/PropertyMappingValidationConventionTest.cs (99%) rename test/EFCore.Tests/Metadata/Conventions/{Internal => }/RelationshipDiscoveryConventionTest.cs (99%) rename test/EFCore.Tests/Metadata/Conventions/{Internal => }/ServicePropertyDiscoveryConventionTest.cs (97%) rename test/EFCore.Tests/Metadata/Conventions/{Internal => }/ValueGeneratorConventionTest.cs (99%) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2859aff83bb..39f0b9a2482 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -9,6 +9,8 @@ variables: value: true - name: _DotNetArtifactsCategory value: ENTITYFRAMEWORKCORE + - name: _CosmosConnectionUrl + value: 'https://ef-nightly-test.documents.azure.com:443/' trigger: - master @@ -77,6 +79,8 @@ jobs: '@ displayName: Cleanup databases - script: eng\common\cibuild.cmd -configuration $(_BuildConfig) -prepareMachine $(_InternalBuildArgs) + env: + Test__Cosmos__Sql__DefaultConnection: $(_CosmosConnectionUrl) name: Build - task: PublishBuildArtifacts@1 displayName: Upload artifacts @@ -92,7 +96,6 @@ jobs: vmImage: macOS-10.13 variables: - ${{ if and(eq(variables['System.TeamProject'], 'public'), eq(variables['system.pullrequest.isfork'], false), notin(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'PullRequest')) }}: - - _CosmosConnection: https://ef-nightly-test.documents.azure.com:443/ - _CosmosToken: $(ef-nightly-cosmos-key) steps: - bash: brew install libspatialite @@ -100,7 +103,7 @@ jobs: continueOnError: true - script: eng/common/cibuild.sh --configuration $(_BuildConfig) --binaryLog --prepareMachine env: - Test__Cosmos__Sql__DefaultConnection: $(_CosmosConnection) + Test__Cosmos__Sql__DefaultConnection: $(_CosmosConnectionUrl) Test__Cosmos__Sql__AuthToken: $(_CosmosToken) name: Build continueOnError: true @@ -113,4 +116,6 @@ jobs: displayName: Install SpatiaLite continueOnError: true - script: eng/common/cibuild.sh --configuration $(_BuildConfig) --prepareMachine + env: + Test__Cosmos__Sql__DefaultConnection: $(_CosmosConnectionUrl) name: Build diff --git a/src/EFCore/Metadata/Builders/EntityTypeBuilder.cs b/src/EFCore/Metadata/Builders/EntityTypeBuilder.cs index bfe26fc73dd..7e8f0237b03 100644 --- a/src/EFCore/Metadata/Builders/EntityTypeBuilder.cs +++ b/src/EFCore/Metadata/Builders/EntityTypeBuilder.cs @@ -859,21 +859,19 @@ public virtual DataBuilder HasData([NotNull] IEnumerable data) } /// - /// Configures the discriminator column used to identify which entity type each row in a table represents - /// when an inheritance hierarchy is mapped to a single table in a relational database. + /// Configures the discriminator property used to identify the entity type in the store. /// - /// A builder that allows the discriminator column to be configured. + /// A builder that allows the discriminator property to be configured. public virtual DiscriminatorBuilder HasDiscriminator() => Builder.DiscriminatorBuilder( Builder.GetOrCreateDiscriminatorProperty(null, null, true), ConfigurationSource.Explicit); /// - /// Configures the discriminator column used to identify which entity type each row in a table represents - /// when an inheritance hierarchy is mapped to a single table in a relational database. + /// Configures the discriminator property used to identify the entity type in the store. /// - /// The name of the discriminator column. - /// The type of values stored in the discriminator column. - /// A builder that allows the discriminator column to be configured. + /// The name of the discriminator property. + /// The type of values stored in the discriminator property. + /// A builder that allows the discriminator property to be configured. public virtual DiscriminatorBuilder HasDiscriminator( [NotNull] string name, [NotNull] Type type) @@ -885,12 +883,11 @@ public virtual DiscriminatorBuilder HasDiscriminator( } /// - /// Configures the discriminator column used to identify which entity type each row in a table represents - /// when an inheritance hierarchy is mapped to a single table in a relational database. + /// Configures the discriminator property used to identify the entity type in the store. /// - /// The type of values stored in the discriminator column. - /// The name of the discriminator column. - /// A builder that allows the discriminator column to be configured. + /// The type of values stored in the discriminator property. + /// The name of the discriminator property. + /// A builder that allows the discriminator property to be configured. public virtual DiscriminatorBuilder HasDiscriminator([NotNull] string name) { Check.NotEmpty(name, nameof(name)); @@ -899,6 +896,16 @@ public virtual DiscriminatorBuilder HasDiscriminator + /// Configures the entity type as having no discriminator property. + /// + /// The same builder instance so that multiple configuration calls can be chained. + public virtual EntityTypeBuilder HasNoDiscriminator() + { + Builder.HasNoDeclaredDiscriminator(ConfigurationSource.Explicit); + return this; + } + #region Hidden System.Object members /// diff --git a/src/EFCore/Metadata/Builders/EntityTypeBuilder`.cs b/src/EFCore/Metadata/Builders/EntityTypeBuilder`.cs index 6949ce76b43..440e0cf09c9 100644 --- a/src/EFCore/Metadata/Builders/EntityTypeBuilder`.cs +++ b/src/EFCore/Metadata/Builders/EntityTypeBuilder`.cs @@ -756,15 +756,14 @@ public virtual DataBuilder HasData([NotNull] IEnumerable data) } /// - /// Configures the discriminator column used to identify which entity type each row in a table represents - /// when an inheritance hierarchy is mapped to a single table in a relational database. + /// Configures the discriminator property used to identify the entity type in the store. /// - /// The type of values stored in the discriminator column. + /// The type of values stored in the discriminator property. /// /// A lambda expression representing the property to be used as the discriminator ( /// blog => blog.Discriminator). /// - /// A builder that allows the discriminator column to be configured. + /// A builder that allows the discriminator property to be configured. public virtual DiscriminatorBuilder HasDiscriminator( [NotNull] Expression> propertyExpression) { @@ -774,6 +773,13 @@ public virtual DiscriminatorBuilder HasDiscriminator + /// Configures the entity type as having no discriminator property. + /// + /// The same builder instance so that multiple configuration calls can be chained. + public new virtual EntityTypeBuilder HasNoDiscriminator() + => (EntityTypeBuilder)base.HasNoDiscriminator(); + private InternalEntityTypeBuilder Builder => this.GetInfrastructure(); } } diff --git a/src/EFCore/Metadata/Internal/EntityType.cs b/src/EFCore/Metadata/Internal/EntityType.cs index d71e338e6b8..c7597b86a0f 100644 --- a/src/EFCore/Metadata/Internal/EntityType.cs +++ b/src/EFCore/Metadata/Internal/EntityType.cs @@ -2519,23 +2519,27 @@ public virtual void SetDiscriminatorProperty([CanBeNull] IProperty property, Con { CheckDiscriminatorProperty(property); - if (property != null - && !property.ClrType.IsInstanceOfType(this.GetDiscriminatorValue())) + if ((property == null + || !property.ClrType.IsInstanceOfType(this.GetDiscriminatorValue()))) { - foreach (var derivedType in GetDerivedTypesInclusive()) + ((IMutableEntityType)this).RemoveDiscriminatorValue(); + if (BaseType == null) { - ((IMutableEntityType)derivedType).RemoveDiscriminatorValue(); + foreach (var derivedType in GetDerivedTypes()) + { + ((IMutableEntityType)derivedType).RemoveDiscriminatorValue(); + } } } - this.SetOrRemoveAnnotation(CoreAnnotationNames.DiscriminatorProperty, property?.Name, configurationSource); + SetAnnotation(CoreAnnotationNames.DiscriminatorProperty, property?.Name, configurationSource); } private void CheckDiscriminatorProperty(IProperty property) { if (property != null) { - if (this != RootType()) + if (BaseType != null) { throw new InvalidOperationException( CoreStrings.DiscriminatorPropertyMustBeOnRoot(this.DisplayName())); diff --git a/src/EFCore/Metadata/Internal/InternalEntityTypeBuilder.cs b/src/EFCore/Metadata/Internal/InternalEntityTypeBuilder.cs index 0e41b9f7766..c27a25e7540 100644 --- a/src/EFCore/Metadata/Internal/InternalEntityTypeBuilder.cs +++ b/src/EFCore/Metadata/Internal/InternalEntityTypeBuilder.cs @@ -3374,9 +3374,38 @@ public virtual DiscriminatorBuilder DiscriminatorBuilder( discriminatorPropertyBuilder = rootTypeBuilder.Property( discriminatorProperty.ClrType, discriminatorProperty.Name, null, ConfigurationSource.Convention); + RemoveUnusedDiscriminatorProperty(discriminatorProperty, configurationSource); + + rootTypeBuilder.Metadata.SetDiscriminatorProperty(discriminatorProperty, configurationSource); + discriminatorPropertyBuilder.IsRequired(true, configurationSource); + discriminatorPropertyBuilder.HasValueGenerator(DiscriminatorValueGenerator.Factory, configurationSource); + + return new DiscriminatorBuilder(Metadata); + } + + public virtual InternalEntityTypeBuilder HasNoDeclaredDiscriminator(ConfigurationSource configurationSource) + { + if (Metadata[CoreAnnotationNames.DiscriminatorProperty] != null + && !configurationSource.Overrides(Metadata.GetDiscriminatorPropertyConfigurationSource())) + { + return null; + } + + if (Metadata.BaseType == null) + { + RemoveUnusedDiscriminatorProperty(null, configurationSource); + } + + Metadata.SetDiscriminatorProperty(null, configurationSource); + + return this; + } + + private void RemoveUnusedDiscriminatorProperty(Property newDiscriminatorProperty, ConfigurationSource configurationSource) + { var oldDiscriminatorProperty = Metadata.GetDiscriminatorProperty() as Property; if (oldDiscriminatorProperty?.Builder != null - && oldDiscriminatorProperty != discriminatorProperty) + && oldDiscriminatorProperty != newDiscriminatorProperty) { oldDiscriminatorProperty.DeclaringEntityType.Builder.RemoveUnusedShadowProperties( new[] @@ -3390,12 +3419,6 @@ public virtual DiscriminatorBuilder DiscriminatorBuilder( oldDiscriminatorProperty.Builder.HasValueGenerator((Type)null, configurationSource); } } - - rootTypeBuilder.Metadata.SetDiscriminatorProperty(discriminatorProperty, configurationSource); - discriminatorPropertyBuilder.IsRequired(true, configurationSource); - discriminatorPropertyBuilder.HasValueGenerator(DiscriminatorValueGenerator.Factory, configurationSource); - - return new DiscriminatorBuilder(Metadata); } private bool CanSetDiscriminator( @@ -3403,10 +3426,9 @@ private bool CanSetDiscriminator( string name, Type discriminatorType, bool fromDataAnnotation) - => discriminatorProperty == null - || ((name != null || discriminatorType != null) - && (name == null || discriminatorProperty.Name == name) - && (discriminatorType == null || discriminatorProperty.ClrType == discriminatorType)) + => (name == null && discriminatorType == null) + || ((name == null || discriminatorProperty?.Name == name) + && (discriminatorType == null || discriminatorProperty?.ClrType == discriminatorType)) || (fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention) .Overrides(Metadata.GetDiscriminatorPropertyConfigurationSource()); @@ -3745,31 +3767,7 @@ IConventionDiscriminatorBuilder IConventionEntityTypeBuilder.HasDiscriminator(Me /// IConventionEntityTypeBuilder IConventionEntityTypeBuilder.HasNoDeclaredDiscriminator(bool fromDataAnnotation) - { - var discriminatorName = (string)Metadata[CoreAnnotationNames.DiscriminatorProperty]; - if (discriminatorName == null) - { - return this; - } - - var discriminatorProperty = Metadata.FindProperty(discriminatorName); - if (discriminatorProperty != null) - { - if (!CanSetDiscriminator(discriminatorProperty, null, null, fromDataAnnotation)) - { - return null; - } - - discriminatorProperty.DeclaringEntityType.Builder.RemoveUnusedShadowProperties( - new[] - { - discriminatorProperty - }); - } - - Metadata.SetDiscriminatorProperty(null, fromDataAnnotation); - return this; - } + => HasNoDeclaredDiscriminator(fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention); /// bool IConventionEntityTypeBuilder.CanSetDiscriminator(string name, bool fromDataAnnotation) diff --git a/test/EFCore.Cosmos.Tests/Metadata/CosmosBuilderExtensionsTest.cs b/test/EFCore.Cosmos.Tests/Metadata/CosmosBuilderExtensionsTest.cs index eaabdda5440..544263b7639 100644 --- a/test/EFCore.Cosmos.Tests/Metadata/CosmosBuilderExtensionsTest.cs +++ b/test/EFCore.Cosmos.Tests/Metadata/CosmosBuilderExtensionsTest.cs @@ -34,6 +34,33 @@ public void Default_container_name_is_used_if_not_set() Assert.Equal("db1", entityType.GetCosmosContainerName()); } + [ConditionalFact] + public void Default_discriminator_can_be_removed() + { + var modelBuilder = CreateConventionModelBuilder(); + + modelBuilder.Entity(); + + var entityType = modelBuilder.Model.FindEntityType(typeof(Customer)); + + Assert.Equal("Discriminator", entityType.GetDiscriminatorProperty().Name); + Assert.Equal(nameof(Customer), entityType.GetDiscriminatorValue()); + + modelBuilder.Entity().HasNoDiscriminator(); + + Assert.Null(entityType.GetDiscriminatorProperty()); + Assert.Null(entityType.GetDiscriminatorValue()); + + modelBuilder.Entity().HasBaseType(); + + Assert.Equal("Discriminator", entityType.GetDiscriminatorProperty().Name); + Assert.Equal(nameof(Customer), entityType.GetDiscriminatorValue()); + + modelBuilder.Entity().HasBaseType((string)null); + + Assert.Null(entityType.GetDiscriminatorProperty()); + } + protected virtual ModelBuilder CreateConventionModelBuilder() => CosmosTestHelpers.Instance.CreateConventionBuilder(); private class Customer diff --git a/test/EFCore.Tests/Metadata/Conventions/Internal/BackingFieldConventionTest.cs b/test/EFCore.Tests/Metadata/Conventions/BackingFieldConventionTest.cs similarity index 99% rename from test/EFCore.Tests/Metadata/Conventions/Internal/BackingFieldConventionTest.cs rename to test/EFCore.Tests/Metadata/Conventions/BackingFieldConventionTest.cs index daf3d31fbf3..aa398ec31d5 100644 --- a/test/EFCore.Tests/Metadata/Conventions/Internal/BackingFieldConventionTest.cs +++ b/test/EFCore.Tests/Metadata/Conventions/BackingFieldConventionTest.cs @@ -6,6 +6,7 @@ using Microsoft.EntityFrameworkCore.Diagnostics; using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal; using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.TestUtilities; using Microsoft.Extensions.DependencyInjection; @@ -21,7 +22,7 @@ #pragma warning disable RCS1213 // Remove unused member declaration. -namespace Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal +namespace Microsoft.EntityFrameworkCore.Metadata.Conventions { public class BackingFieldConventionTest { diff --git a/test/EFCore.Tests/Metadata/Conventions/Internal/BaseTypeDiscoveryConventionTest.cs b/test/EFCore.Tests/Metadata/Conventions/BaseTypeDiscoveryConventionTest.cs similarity index 96% rename from test/EFCore.Tests/Metadata/Conventions/Internal/BaseTypeDiscoveryConventionTest.cs rename to test/EFCore.Tests/Metadata/Conventions/BaseTypeDiscoveryConventionTest.cs index cf41667ff17..4440345faa6 100644 --- a/test/EFCore.Tests/Metadata/Conventions/Internal/BaseTypeDiscoveryConventionTest.cs +++ b/test/EFCore.Tests/Metadata/Conventions/BaseTypeDiscoveryConventionTest.cs @@ -3,12 +3,13 @@ using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal; using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.TestUtilities; using Microsoft.Extensions.DependencyInjection; using Xunit; -namespace Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal +namespace Microsoft.EntityFrameworkCore.Metadata.Conventions { public class BaseTypeDiscoveryConventionTest { diff --git a/test/EFCore.Tests/Metadata/Conventions/Internal/CascadeDeleteConventionTest.cs b/test/EFCore.Tests/Metadata/Conventions/CascadeDeleteConventionTest.cs similarity index 98% rename from test/EFCore.Tests/Metadata/Conventions/Internal/CascadeDeleteConventionTest.cs rename to test/EFCore.Tests/Metadata/Conventions/CascadeDeleteConventionTest.cs index acd9d245fcd..a017939ee41 100644 --- a/test/EFCore.Tests/Metadata/Conventions/Internal/CascadeDeleteConventionTest.cs +++ b/test/EFCore.Tests/Metadata/Conventions/CascadeDeleteConventionTest.cs @@ -10,7 +10,7 @@ // ReSharper disable ClassNeverInstantiated.Local // ReSharper disable CollectionNeverUpdated.Local // ReSharper disable InconsistentNaming -namespace Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal +namespace Microsoft.EntityFrameworkCore.Metadata.Conventions { public class CascadeDeleteConventionTest { diff --git a/test/EFCore.Tests/Metadata/Conventions/Internal/ConstructorBindingConventionTest.cs b/test/EFCore.Tests/Metadata/Conventions/ConstructorBindingConventionTest.cs similarity index 99% rename from test/EFCore.Tests/Metadata/Conventions/Internal/ConstructorBindingConventionTest.cs rename to test/EFCore.Tests/Metadata/Conventions/ConstructorBindingConventionTest.cs index a2213d79c22..ce2271af316 100644 --- a/test/EFCore.Tests/Metadata/Conventions/Internal/ConstructorBindingConventionTest.cs +++ b/test/EFCore.Tests/Metadata/Conventions/ConstructorBindingConventionTest.cs @@ -8,6 +8,7 @@ using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal; using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.TestUtilities; using Microsoft.Extensions.DependencyInjection; @@ -21,7 +22,7 @@ // ReSharper disable MemberCanBePrivate.Local // ReSharper disable MemberHidesStaticFromOuterClass // ReSharper disable InconsistentNaming -namespace Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal +namespace Microsoft.EntityFrameworkCore.Metadata.Conventions { public class ConstructorBindingConventionTest { diff --git a/test/EFCore.Tests/Metadata/Conventions/Internal/ConventionDispatcherTest.cs b/test/EFCore.Tests/Metadata/Conventions/ConventionDispatcherTest.cs similarity index 99% rename from test/EFCore.Tests/Metadata/Conventions/Internal/ConventionDispatcherTest.cs rename to test/EFCore.Tests/Metadata/Conventions/ConventionDispatcherTest.cs index be0346d08fc..9e33604abe6 100644 --- a/test/EFCore.Tests/Metadata/Conventions/Internal/ConventionDispatcherTest.cs +++ b/test/EFCore.Tests/Metadata/Conventions/ConventionDispatcherTest.cs @@ -11,7 +11,7 @@ using Xunit; // ReSharper disable InconsistentNaming -namespace Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal +namespace Microsoft.EntityFrameworkCore.Metadata.Conventions { public class ConventionDispatcherTest { diff --git a/test/EFCore.Tests/Metadata/Conventions/Internal/DerivedTypeDiscoveryConventionTest.cs b/test/EFCore.Tests/Metadata/Conventions/DerivedTypeDiscoveryConventionTest.cs similarity index 96% rename from test/EFCore.Tests/Metadata/Conventions/Internal/DerivedTypeDiscoveryConventionTest.cs rename to test/EFCore.Tests/Metadata/Conventions/DerivedTypeDiscoveryConventionTest.cs index 6ea5abb1d34..7b3601f9df2 100644 --- a/test/EFCore.Tests/Metadata/Conventions/Internal/DerivedTypeDiscoveryConventionTest.cs +++ b/test/EFCore.Tests/Metadata/Conventions/DerivedTypeDiscoveryConventionTest.cs @@ -3,12 +3,13 @@ using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal; using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.TestUtilities; using Microsoft.Extensions.DependencyInjection; using Xunit; -namespace Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal +namespace Microsoft.EntityFrameworkCore.Metadata.Conventions { public class DerivedTypeDiscoveryConventionTest { diff --git a/test/EFCore.Relational.Tests/Metadata/Conventions/Internal/DiscriminatorConventionTest.cs b/test/EFCore.Tests/Metadata/Conventions/DiscriminatorConventionTest.cs similarity index 97% rename from test/EFCore.Relational.Tests/Metadata/Conventions/Internal/DiscriminatorConventionTest.cs rename to test/EFCore.Tests/Metadata/Conventions/DiscriminatorConventionTest.cs index 8cfec9949ce..05f5628a538 100644 --- a/test/EFCore.Relational.Tests/Metadata/Conventions/Internal/DiscriminatorConventionTest.cs +++ b/test/EFCore.Tests/Metadata/Conventions/DiscriminatorConventionTest.cs @@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal; using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.TestUtilities; using Microsoft.Extensions.DependencyInjection; @@ -12,7 +13,7 @@ // ReSharper disable UnusedMember.Local // ReSharper disable InconsistentNaming -namespace Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal +namespace Microsoft.EntityFrameworkCore.Metadata.Conventions { public class DiscriminatorConventionTest { @@ -163,7 +164,7 @@ private void RunConvention(InternalEntityTypeBuilder entityTypeBuilder, EntityTy } private ProviderConventionSetBuilderDependencies CreateDependencies() - => RelationalTestHelpers.Instance.CreateContextServices().GetRequiredService(); + => InMemoryTestHelpers.Instance.CreateContextServices().GetRequiredService(); private class EntityBase { diff --git a/test/EFCore.Tests/Metadata/Conventions/Internal/EntityTypeAttributeConventionTest.cs b/test/EFCore.Tests/Metadata/Conventions/EntityTypeAttributeConventionTest.cs similarity index 95% rename from test/EFCore.Tests/Metadata/Conventions/Internal/EntityTypeAttributeConventionTest.cs rename to test/EFCore.Tests/Metadata/Conventions/EntityTypeAttributeConventionTest.cs index 06d1efa27eb..98de850e7b8 100644 --- a/test/EFCore.Tests/Metadata/Conventions/Internal/EntityTypeAttributeConventionTest.cs +++ b/test/EFCore.Tests/Metadata/Conventions/EntityTypeAttributeConventionTest.cs @@ -5,6 +5,7 @@ using System.Linq; using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal; using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.TestUtilities; using Microsoft.Extensions.DependencyInjection; @@ -12,7 +13,7 @@ // ReSharper disable UnusedMember.Local // ReSharper disable InconsistentNaming -namespace Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal +namespace Microsoft.EntityFrameworkCore.Metadata.Conventions { public class EntityTypeAttributeConventionTest { diff --git a/test/EFCore.Tests/Metadata/Conventions/Internal/ForeignKeyIndexConventionTest.cs b/test/EFCore.Tests/Metadata/Conventions/ForeignKeyIndexConventionTest.cs similarity index 96% rename from test/EFCore.Tests/Metadata/Conventions/Internal/ForeignKeyIndexConventionTest.cs rename to test/EFCore.Tests/Metadata/Conventions/ForeignKeyIndexConventionTest.cs index b20f4a569ea..5e274f9abbe 100644 --- a/test/EFCore.Tests/Metadata/Conventions/Internal/ForeignKeyIndexConventionTest.cs +++ b/test/EFCore.Tests/Metadata/Conventions/ForeignKeyIndexConventionTest.cs @@ -7,7 +7,7 @@ // ReSharper disable ClassNeverInstantiated.Local // ReSharper disable ClassWithVirtualMembersNeverInherited.Local // ReSharper disable InconsistentNaming -namespace Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal +namespace Microsoft.EntityFrameworkCore.Metadata.Conventions { public class ForeignKeyIndexConventionTest { diff --git a/test/EFCore.Tests/Metadata/Conventions/Internal/ForeignKeyPropertyDiscoveryConventionTest.cs b/test/EFCore.Tests/Metadata/Conventions/ForeignKeyPropertyDiscoveryConventionTest.cs similarity index 99% rename from test/EFCore.Tests/Metadata/Conventions/Internal/ForeignKeyPropertyDiscoveryConventionTest.cs rename to test/EFCore.Tests/Metadata/Conventions/ForeignKeyPropertyDiscoveryConventionTest.cs index da1a95cfe6d..9ef2686dc37 100644 --- a/test/EFCore.Tests/Metadata/Conventions/Internal/ForeignKeyPropertyDiscoveryConventionTest.cs +++ b/test/EFCore.Tests/Metadata/Conventions/ForeignKeyPropertyDiscoveryConventionTest.cs @@ -11,6 +11,7 @@ using Microsoft.EntityFrameworkCore.Internal; using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal; using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.TestUtilities; using Microsoft.Extensions.DependencyInjection; @@ -21,7 +22,7 @@ // ReSharper disable UnusedAutoPropertyAccessor.Local // ReSharper disable MemberCanBePrivate.Local // ReSharper disable InconsistentNaming -namespace Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal +namespace Microsoft.EntityFrameworkCore.Metadata.Conventions { public class ForeignKeyPropertyDiscoveryConventionTest { diff --git a/test/EFCore.Tests/Metadata/Conventions/Internal/KeyDiscoveryConventionTest.cs b/test/EFCore.Tests/Metadata/Conventions/KeyDiscoveryConventionTest.cs similarity index 98% rename from test/EFCore.Tests/Metadata/Conventions/Internal/KeyDiscoveryConventionTest.cs rename to test/EFCore.Tests/Metadata/Conventions/KeyDiscoveryConventionTest.cs index 51c591848b6..8a68c8445c8 100644 --- a/test/EFCore.Tests/Metadata/Conventions/Internal/KeyDiscoveryConventionTest.cs +++ b/test/EFCore.Tests/Metadata/Conventions/KeyDiscoveryConventionTest.cs @@ -8,6 +8,7 @@ using Microsoft.EntityFrameworkCore.Internal; using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal; using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.TestUtilities; using Microsoft.Extensions.DependencyInjection; @@ -19,7 +20,7 @@ // ReSharper disable ClassNeverInstantiated.Local // ReSharper disable UnusedMember.Local // ReSharper disable InconsistentNaming -namespace Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal +namespace Microsoft.EntityFrameworkCore.Metadata.Conventions { public class KeyDiscoveryConventionTest { diff --git a/test/EFCore.Tests/Metadata/Conventions/Internal/ModelCleanupConventionTest.cs b/test/EFCore.Tests/Metadata/Conventions/ModelCleanupConventionTest.cs similarity index 97% rename from test/EFCore.Tests/Metadata/Conventions/Internal/ModelCleanupConventionTest.cs rename to test/EFCore.Tests/Metadata/Conventions/ModelCleanupConventionTest.cs index ad96b23c91e..598adb15c3e 100644 --- a/test/EFCore.Tests/Metadata/Conventions/Internal/ModelCleanupConventionTest.cs +++ b/test/EFCore.Tests/Metadata/Conventions/ModelCleanupConventionTest.cs @@ -4,12 +4,13 @@ using System.Linq; using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal; using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.TestUtilities; using Microsoft.Extensions.DependencyInjection; using Xunit; -namespace Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal +namespace Microsoft.EntityFrameworkCore.Metadata.Conventions { public class ModelCleanupConventionTest { diff --git a/test/EFCore.Tests/Metadata/Conventions/Internal/NavigationAttributeConventionTest.cs b/test/EFCore.Tests/Metadata/Conventions/NavigationAttributeConventionTest.cs similarity index 99% rename from test/EFCore.Tests/Metadata/Conventions/Internal/NavigationAttributeConventionTest.cs rename to test/EFCore.Tests/Metadata/Conventions/NavigationAttributeConventionTest.cs index 0a26ee5882c..dd1c588f21c 100644 --- a/test/EFCore.Tests/Metadata/Conventions/Internal/NavigationAttributeConventionTest.cs +++ b/test/EFCore.Tests/Metadata/Conventions/NavigationAttributeConventionTest.cs @@ -14,6 +14,7 @@ using Microsoft.EntityFrameworkCore.Internal; using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal; using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.TestUtilities; using Microsoft.Extensions.DependencyInjection; @@ -25,7 +26,7 @@ // ReSharper disable ClassNeverInstantiated.Local // ReSharper disable UnusedMember.Local // ReSharper disable UnusedAutoPropertyAccessor.Local -namespace Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal +namespace Microsoft.EntityFrameworkCore.Metadata.Conventions { public class NavigationAttributeConventionTest { diff --git a/test/EFCore.Tests/Metadata/Conventions/Internal/NonNullableNavigationConventionTest.cs b/test/EFCore.Tests/Metadata/Conventions/NonNullableNavigationConventionTest.cs similarity index 99% rename from test/EFCore.Tests/Metadata/Conventions/Internal/NonNullableNavigationConventionTest.cs rename to test/EFCore.Tests/Metadata/Conventions/NonNullableNavigationConventionTest.cs index dec5fe7c177..db21adc4d2c 100644 --- a/test/EFCore.Tests/Metadata/Conventions/Internal/NonNullableNavigationConventionTest.cs +++ b/test/EFCore.Tests/Metadata/Conventions/NonNullableNavigationConventionTest.cs @@ -9,13 +9,14 @@ using Microsoft.EntityFrameworkCore.Diagnostics.Internal; using Microsoft.EntityFrameworkCore.Internal; using Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal; using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.TestUtilities; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Xunit; -namespace Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal +namespace Microsoft.EntityFrameworkCore.Metadata.Conventions { public class NonNullableNavigationConventionTest { diff --git a/test/EFCore.Tests/Metadata/Conventions/Internal/NonNullableReferencePropertyConventionTest.cs b/test/EFCore.Tests/Metadata/Conventions/NonNullableReferencePropertyConventionTest.cs similarity index 97% rename from test/EFCore.Tests/Metadata/Conventions/Internal/NonNullableReferencePropertyConventionTest.cs rename to test/EFCore.Tests/Metadata/Conventions/NonNullableReferencePropertyConventionTest.cs index 1eb36e25b0f..0113675eb23 100644 --- a/test/EFCore.Tests/Metadata/Conventions/Internal/NonNullableReferencePropertyConventionTest.cs +++ b/test/EFCore.Tests/Metadata/Conventions/NonNullableReferencePropertyConventionTest.cs @@ -4,12 +4,13 @@ using System.ComponentModel.DataAnnotations; using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal; using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.TestUtilities; using Microsoft.Extensions.DependencyInjection; using Xunit; -namespace Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal +namespace Microsoft.EntityFrameworkCore.Metadata.Conventions { public class NonNullableReferencePropertyConventionTest { diff --git a/test/EFCore.Tests/Metadata/Conventions/Internal/PropertyAttributeConventionTest.cs b/test/EFCore.Tests/Metadata/Conventions/PropertyAttributeConventionTest.cs similarity index 99% rename from test/EFCore.Tests/Metadata/Conventions/Internal/PropertyAttributeConventionTest.cs rename to test/EFCore.Tests/Metadata/Conventions/PropertyAttributeConventionTest.cs index d83e2f84e6d..b66edeacbc9 100644 --- a/test/EFCore.Tests/Metadata/Conventions/Internal/PropertyAttributeConventionTest.cs +++ b/test/EFCore.Tests/Metadata/Conventions/PropertyAttributeConventionTest.cs @@ -9,6 +9,7 @@ using Microsoft.EntityFrameworkCore.Diagnostics; using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal; using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.TestUtilities; using Microsoft.Extensions.DependencyInjection; @@ -18,7 +19,7 @@ // ReSharper disable UnusedMember.Local // ReSharper disable UnusedAutoPropertyAccessor.Local // ReSharper disable ClassNeverInstantiated.Local -namespace Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal +namespace Microsoft.EntityFrameworkCore.Metadata.Conventions { public class PropertyAttributeConventionTest { diff --git a/test/EFCore.Tests/Metadata/Conventions/Internal/PropertyDiscoveryConventionTest.cs b/test/EFCore.Tests/Metadata/Conventions/PropertyDiscoveryConventionTest.cs similarity index 98% rename from test/EFCore.Tests/Metadata/Conventions/Internal/PropertyDiscoveryConventionTest.cs rename to test/EFCore.Tests/Metadata/Conventions/PropertyDiscoveryConventionTest.cs index 85d2562b9df..de32de49cfd 100644 --- a/test/EFCore.Tests/Metadata/Conventions/Internal/PropertyDiscoveryConventionTest.cs +++ b/test/EFCore.Tests/Metadata/Conventions/PropertyDiscoveryConventionTest.cs @@ -6,6 +6,7 @@ using System.Reflection; using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal; using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.TestUtilities; using Microsoft.Extensions.DependencyInjection; @@ -15,7 +16,7 @@ // ReSharper disable InconsistentNaming // ReSharper disable UnusedMember.Local // ReSharper disable ClassNeverInstantiated.Local -namespace Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal +namespace Microsoft.EntityFrameworkCore.Metadata.Conventions { public class PropertyDiscoveryConventionTest { diff --git a/test/EFCore.Tests/Metadata/Conventions/Internal/PropertyMappingValidationConventionTest.cs b/test/EFCore.Tests/Metadata/Conventions/PropertyMappingValidationConventionTest.cs similarity index 99% rename from test/EFCore.Tests/Metadata/Conventions/Internal/PropertyMappingValidationConventionTest.cs rename to test/EFCore.Tests/Metadata/Conventions/PropertyMappingValidationConventionTest.cs index 79a4ee4f2e5..5fd7f7d9363 100644 --- a/test/EFCore.Tests/Metadata/Conventions/Internal/PropertyMappingValidationConventionTest.cs +++ b/test/EFCore.Tests/Metadata/Conventions/PropertyMappingValidationConventionTest.cs @@ -16,7 +16,7 @@ using Xunit; // ReSharper disable InconsistentNaming -namespace Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal +namespace Microsoft.EntityFrameworkCore.Metadata.Conventions { public class PropertyMappingValidationConventionTest : ModelValidatorTestBase { diff --git a/test/EFCore.Tests/Metadata/Conventions/Internal/RelationshipDiscoveryConventionTest.cs b/test/EFCore.Tests/Metadata/Conventions/RelationshipDiscoveryConventionTest.cs similarity index 99% rename from test/EFCore.Tests/Metadata/Conventions/Internal/RelationshipDiscoveryConventionTest.cs rename to test/EFCore.Tests/Metadata/Conventions/RelationshipDiscoveryConventionTest.cs index c922ed6b72c..5e2f596d607 100644 --- a/test/EFCore.Tests/Metadata/Conventions/Internal/RelationshipDiscoveryConventionTest.cs +++ b/test/EFCore.Tests/Metadata/Conventions/RelationshipDiscoveryConventionTest.cs @@ -12,6 +12,7 @@ using Microsoft.EntityFrameworkCore.Internal; using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal; using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.TestUtilities; using Microsoft.Extensions.DependencyInjection; @@ -25,7 +26,7 @@ // ReSharper disable UnusedMember.Local // ReSharper disable ClassNeverInstantiated.Local // ReSharper disable InconsistentNaming -namespace Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal +namespace Microsoft.EntityFrameworkCore.Metadata.Conventions { public class RelationshipDiscoveryConventionTest { diff --git a/test/EFCore.Tests/Metadata/Conventions/Internal/ServicePropertyDiscoveryConventionTest.cs b/test/EFCore.Tests/Metadata/Conventions/ServicePropertyDiscoveryConventionTest.cs similarity index 97% rename from test/EFCore.Tests/Metadata/Conventions/Internal/ServicePropertyDiscoveryConventionTest.cs rename to test/EFCore.Tests/Metadata/Conventions/ServicePropertyDiscoveryConventionTest.cs index f66b76e96b4..1bf5b36a4bf 100644 --- a/test/EFCore.Tests/Metadata/Conventions/Internal/ServicePropertyDiscoveryConventionTest.cs +++ b/test/EFCore.Tests/Metadata/Conventions/ServicePropertyDiscoveryConventionTest.cs @@ -7,6 +7,7 @@ using Microsoft.EntityFrameworkCore.Internal; using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal; using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.TestUtilities; using Microsoft.Extensions.DependencyInjection; @@ -16,7 +17,7 @@ // ReSharper disable UnusedAutoPropertyAccessor.Local // ReSharper disable ClassNeverInstantiated.Local // ReSharper disable InconsistentNaming -namespace Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal +namespace Microsoft.EntityFrameworkCore.Metadata.Conventions { public class ServicePropertyDiscoveryConventionTest { diff --git a/test/EFCore.Tests/Metadata/Conventions/Internal/ValueGeneratorConventionTest.cs b/test/EFCore.Tests/Metadata/Conventions/ValueGeneratorConventionTest.cs similarity index 99% rename from test/EFCore.Tests/Metadata/Conventions/Internal/ValueGeneratorConventionTest.cs rename to test/EFCore.Tests/Metadata/Conventions/ValueGeneratorConventionTest.cs index 86cc756b036..13f4615cd80 100644 --- a/test/EFCore.Tests/Metadata/Conventions/Internal/ValueGeneratorConventionTest.cs +++ b/test/EFCore.Tests/Metadata/Conventions/ValueGeneratorConventionTest.cs @@ -5,6 +5,7 @@ using System.Linq; using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal; using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.TestUtilities; using Microsoft.Extensions.DependencyInjection; @@ -12,7 +13,7 @@ // ReSharper disable InconsistentNaming // ReSharper disable UnusedMember.Local -namespace Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal +namespace Microsoft.EntityFrameworkCore.Metadata.Conventions { public class ValueGeneratorConventionTest { diff --git a/test/EFCore.Tests/Metadata/Internal/InternalEntityTypeBuilderTest.cs b/test/EFCore.Tests/Metadata/Internal/InternalEntityTypeBuilderTest.cs index 871187f3dff..50824071663 100644 --- a/test/EFCore.Tests/Metadata/Internal/InternalEntityTypeBuilderTest.cs +++ b/test/EFCore.Tests/Metadata/Internal/InternalEntityTypeBuilderTest.cs @@ -2825,7 +2825,7 @@ public void Can_access_discriminator_value() Assert.NotNull(typeBuilder.HasNoDeclaredDiscriminator(fromDataAnnotation: true)); Assert.Null(typeBuilder.Metadata.GetDiscriminatorProperty()); - Assert.Equal(4, typeBuilder.Metadata.GetDiscriminatorValue()); + Assert.Null(typeBuilder.Metadata.GetDiscriminatorValue()); Assert.Empty(typeBuilder.Metadata.GetProperties()); }