diff --git a/src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs b/src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs index f5b41e6d1f2..90124645db5 100644 --- a/src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs +++ b/src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs @@ -1525,5 +1525,31 @@ protected virtual void ValidateIndexProperties( } } } + + /// + /// Throws an with a message containing provider-specific information, when + /// available, indicating possible reasons why the property cannot be mapped. + /// + /// The property CLR type. + /// The entity type. + /// The property. + protected override void ThrowPropertyNotMappedException( + string propertyType, + IConventionEntityType entityType, + IConventionProperty unmappedProperty) + { + var storeType = unmappedProperty.GetColumnType(); + if (storeType != null) + { + throw new InvalidOperationException( + RelationalStrings.PropertyNotMapped( + propertyType, + entityType.DisplayName(), + unmappedProperty.Name, + storeType)); + } + + base.ThrowPropertyNotMappedException(propertyType, entityType, unmappedProperty); + } } } diff --git a/src/EFCore.Relational/Properties/RelationalStrings.Designer.cs b/src/EFCore.Relational/Properties/RelationalStrings.Designer.cs index 2e1205ccf64..666670a047e 100644 --- a/src/EFCore.Relational/Properties/RelationalStrings.Designer.cs +++ b/src/EFCore.Relational/Properties/RelationalStrings.Designer.cs @@ -977,6 +977,14 @@ public static string PendingAmbientTransaction public static string ProjectionMappingCountMismatch => GetString("ProjectionMappingCountMismatch"); + /// + /// The '{propertyType}' property '{entityType}.{property}' could not be mapped to the database type '{storeType}' because the database provider does not support mapping '{propertyType}' properties to '{storeType}' columns. Consider mapping to a different database type or converting the property value to a type supported by the database using a value converter. See https://aka.ms/efcore-docs-value-converters for more information. Alternately, exclude the property from the model using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'. + /// + public static string PropertyNotMapped(object? propertyType, object? entityType, object? property, object? storeType) + => string.Format( + GetString("PropertyNotMapped", nameof(propertyType), nameof(entityType), nameof(property), nameof(storeType)), + propertyType, entityType, property, storeType); + /// /// The property '{property}' on entity type '{entityType}' is not mapped to '{table}'. /// diff --git a/src/EFCore.Relational/Properties/RelationalStrings.resx b/src/EFCore.Relational/Properties/RelationalStrings.resx index 8c45dd86168..59829685011 100644 --- a/src/EFCore.Relational/Properties/RelationalStrings.resx +++ b/src/EFCore.Relational/Properties/RelationalStrings.resx @@ -728,6 +728,9 @@ Unable to translate set operations when both sides don't assign values to the same properties in the nominal type. Please make sure that the same properties are included on both sides, and consider assigning default values if a property doesn't require a specific value. + + The '{propertyType}' property '{entityType}.{property}' could not be mapped to the database type '{storeType}' because the database provider does not support mapping '{propertyType}' properties to '{storeType}' columns. Consider mapping to a different database type or converting the property value to a type supported by the database using a value converter. See https://aka.ms/efcore-docs-value-converters for more information. Alternately, exclude the property from the model using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'. + The property '{property}' on entity type '{entityType}' is not mapped to '{table}'. diff --git a/src/EFCore/ChangeTracking/Internal/InternalEntityEntry.cs b/src/EFCore/ChangeTracking/Internal/InternalEntityEntry.cs index 31fd7530011..d79ddd8863c 100644 --- a/src/EFCore/ChangeTracking/Internal/InternalEntityEntry.cs +++ b/src/EFCore/ChangeTracking/Internal/InternalEntityEntry.cs @@ -1487,6 +1487,10 @@ public InternalEntityEntry PrepareToSave() && property.IsForeignKey() && _stateData.IsPropertyFlagged(property.GetIndex(), PropertyFlag.Unknown)) { + if (property.GetContainingForeignKeys().Any(fk => fk.IsOwnership)) + { + throw new InvalidOperationException(CoreStrings.SaveOwnedWithoutOwner(entityType.DisplayName())); + } throw new InvalidOperationException(CoreStrings.UnknownKeyValue(entityType.DisplayName(), property.Name)); } } diff --git a/src/EFCore/Infrastructure/ModelValidator.cs b/src/EFCore/Infrastructure/ModelValidator.cs index 01f96c82711..3432b61db8c 100644 --- a/src/EFCore/Infrastructure/ModelValidator.cs +++ b/src/EFCore/Infrastructure/ModelValidator.cs @@ -170,10 +170,10 @@ protected virtual void ValidatePropertyMapping( if (unmappedProperty != null) { - throw new InvalidOperationException( - CoreStrings.PropertyNotMapped( - entityType.DisplayName(), unmappedProperty.Name, - (unmappedProperty.GetValueConverter()?.ProviderClrType ?? unmappedProperty.ClrType).ShortDisplayName())); + ThrowPropertyNotMappedException( + (unmappedProperty.GetValueConverter()?.ProviderClrType ?? unmappedProperty.ClrType).ShortDisplayName(), + entityType, + unmappedProperty); } if (entityType.ClrType == Model.DefaultPropertyBagType) @@ -287,6 +287,23 @@ protected virtual void ValidatePropertyMapping( } } + /// + /// Throws an with a message containing provider-specific information, when + /// available, indicating possible reasons why the property cannot be mapped. + /// + /// The property CLR type. + /// The entity type. + /// The property. + protected virtual void ThrowPropertyNotMappedException( + string propertyType, + IConventionEntityType entityType, + IConventionProperty unmappedProperty) + => throw new InvalidOperationException( + CoreStrings.PropertyNotMapped( + propertyType, + entityType.DisplayName(), + unmappedProperty.Name)); + /// /// Returns a value indicating whether that target CLR type would correspond to an owned entity type. /// diff --git a/src/EFCore/Metadata/Internal/ConstructorBindingFactory.cs b/src/EFCore/Metadata/Internal/ConstructorBindingFactory.cs index 16feab7c732..c306fd3f951 100644 --- a/src/EFCore/Metadata/Internal/ConstructorBindingFactory.cs +++ b/src/EFCore/Metadata/Internal/ConstructorBindingFactory.cs @@ -165,22 +165,18 @@ private void GetBindings( var constructorErrors = bindingFailures.SelectMany(f => f) .GroupBy(f => (ConstructorInfo)f.Member) .Select( - x => CoreStrings.ConstructorBindingFailed( + x => " " + CoreStrings.ConstructorBindingFailed( string.Join("', '", x.Select(f => f.Name)), - entityType.DisplayName() - + "(" - + string.Join( - ", ", x.Key.GetParameters().Select( - y => y.ParameterType.ShortDisplayName() + " " + y.Name) - ) - + ")" - ) + $"{entityType.DisplayName()}({string.Join(", ", ConstructConstructor(x))})") ); + IEnumerable ConstructConstructor(IGrouping parameters) + => parameters.Key.GetParameters().Select(y => $"{y.ParameterType.ShortDisplayName()} {y.Name}"); + throw new InvalidOperationException( CoreStrings.ConstructorNotFound( entityType.DisplayName(), - string.Join("; ", constructorErrors))); + Environment.NewLine + string.Join(Environment.NewLine, constructorErrors) + Environment.NewLine)); } if (foundBindings.Count > 1) diff --git a/src/EFCore/Properties/CoreStrings.Designer.cs b/src/EFCore/Properties/CoreStrings.Designer.cs index 6f039555697..5cd52e597e2 100644 --- a/src/EFCore/Properties/CoreStrings.Designer.cs +++ b/src/EFCore/Properties/CoreStrings.Designer.cs @@ -513,7 +513,7 @@ public static string ConflictingRelationshipNavigation(object? newPrincipalNavig newPrincipalNavigationSpecification, newDependentNavigationSpecification, existingPrincipalNavigationSpecification, existingDependentNavigationSpecification); /// - /// cannot bind '{failedBinds}' in '{parameters}' + /// Cannot bind '{failedBinds}' in '{parameters}' /// public static string ConstructorBindingFailed(object? failedBinds, object? parameters) => string.Format( @@ -529,7 +529,7 @@ public static string ConstructorConflict(object? firstConstructor, object? secon firstConstructor, secondConstructor); /// - /// No suitable constructor was found for entity type '{entityType}'. The following constructors had parameters that could not be bound to properties of the entity type: {constructors}. + /// No suitable constructor was found for entity type '{entityType}'. The following constructors had parameters that could not be bound to properties of the entity type: {constructors}Note that only mapped properties can be bound to constructor parameters. Navigations to related entities, including references to owned types, cannot be bound. /// public static string ConstructorNotFound(object? entityType, object? constructors) => string.Format( @@ -2237,12 +2237,12 @@ public static string PropertyNotFound(object? property, object? entityType) property, entityType); /// - /// The property '{entityType}.{property}' is of type '{propertyType}' which is not supported by the current database provider. Either change the property CLR type, or ignore the property using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'. + /// The '{propertyType}' property '{entityType}.{property}' could not be mapped because the database provider does not support this type. Consider converting the property value to a type supported by the database using a value converter. See https://aka.ms/efcore-docs-value-converters for more information. Alternately, exclude the property from the model using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'. /// - public static string PropertyNotMapped(object? entityType, object? property, object? propertyType) + public static string PropertyNotMapped(object? propertyType, object? entityType, object? property) => string.Format( - GetString("PropertyNotMapped", nameof(entityType), nameof(property), nameof(propertyType)), - entityType, property, propertyType); + GetString("PropertyNotMapped", nameof(propertyType), nameof(entityType), nameof(property)), + propertyType, entityType, property); /// /// The property '{1_entityType}.{0_property}' is defined as read-only after it has been saved, but its value has been modified or marked as modified. @@ -2444,6 +2444,14 @@ public static string RuntimeModelMissingData public static string RuntimeParameterMissingParameter => GetString("RuntimeParameterMissingParameter"); + /// + /// Cannot save instance of '{entityType}' because it is an owned entity without any reference to its owner. Owned entities can only be saved as part of an aggregate also including the owner entity. + /// + public static string SaveOwnedWithoutOwner(object? entityType) + => string.Format( + GetString("SaveOwnedWithoutOwner", nameof(entityType)), + entityType); + /// /// Savepoints are not supported by the database provider in use. /// diff --git a/src/EFCore/Properties/CoreStrings.resx b/src/EFCore/Properties/CoreStrings.resx index bdc146ee962..306a4392583 100644 --- a/src/EFCore/Properties/CoreStrings.resx +++ b/src/EFCore/Properties/CoreStrings.resx @@ -305,13 +305,13 @@ Cannot create a relationship between '{newPrincipalNavigationSpecification}' and '{newDependentNavigationSpecification}' because a relationship already exists between '{existingPrincipalNavigationSpecification}' and '{existingDependentNavigationSpecification}'. Navigations can only participate in a single relationship. If you want to override an existing relationship call 'Ignore' on the navigation '{newDependentNavigationSpecification}' first in 'OnModelCreating'. - cannot bind '{failedBinds}' in '{parameters}' + Cannot bind '{failedBinds}' in '{parameters}' The constructors '{firstConstructor}' and '{secondConstructor}' have the same number of parameters, and can both be used by Entity Framework. The constructor to be used must be configured in 'OnModelCreating'. - No suitable constructor was found for entity type '{entityType}'. The following constructors had parameters that could not be bound to properties of the entity type: {constructors}. + No suitable constructor was found for entity type '{entityType}'. The following constructors had parameters that could not be bound to properties of the entity type: {constructors}Note that only mapped properties can be bound to constructor parameters. Navigations to related entities, including references to owned types, cannot be bound. Cannot access a disposed context instance. A common cause of this error is disposing a context instance that was resolved from dependency injection and then later trying to use the same context instance elsewhere in your application. This may occur if you are calling 'Dispose' on the context instance, or wrapping it in a using statement. If you are using dependency injection, you should let the dependency injection container take care of disposing context instances. @@ -1290,7 +1290,7 @@ The property '{1_entityType}.{0_property}' could not be found. Ensure that the property exists and has been included in the model. - The property '{entityType}.{property}' is of type '{propertyType}' which is not supported by the current database provider. Either change the property CLR type, or ignore the property using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'. + The '{propertyType}' property '{entityType}.{property}' could not be mapped because the database provider does not support this type. Consider converting the property value to a type supported by the database using a value converter. See https://aka.ms/efcore-docs-value-converters for more information. Alternately, exclude the property from the model using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'. The property '{1_entityType}.{0_property}' is defined as read-only after it has been saved, but its value has been modified or marked as modified. @@ -1373,6 +1373,9 @@ While registering a runtime parameter, the lambda expression must have only one parameter which must be same as 'QueryCompilationContext.QueryContextParameter' expression. + + Cannot save instance of '{entityType}' because it is an owned entity without any reference to its owner. Owned entities can only be saved as part of an aggregate also including the owner entity. + Savepoints are not supported by the database provider in use. diff --git a/test/EFCore.Relational.Tests/Infrastructure/RelationalModelValidatorTest.PropertyMapping.cs b/test/EFCore.Relational.Tests/Infrastructure/RelationalModelValidatorTest.PropertyMapping.cs index 57c20f00adc..776c062244e 100644 --- a/test/EFCore.Relational.Tests/Infrastructure/RelationalModelValidatorTest.PropertyMapping.cs +++ b/test/EFCore.Relational.Tests/Infrastructure/RelationalModelValidatorTest.PropertyMapping.cs @@ -20,7 +20,9 @@ public void Throws_when_added_property_is_not_mapped_to_store() Assert.Equal( CoreStrings.PropertyNotMapped( - typeof(NonPrimitiveAsPropertyEntity).ShortDisplayName(), "LongProperty", typeof(Tuple).ShortDisplayName()), + typeof(Tuple).ShortDisplayName(), + typeof(NonPrimitiveAsPropertyEntity).ShortDisplayName(), + "LongProperty"), Assert.Throws(() => Validate(modelBuilder)).Message); } @@ -33,9 +35,11 @@ public void Throws_when_added_property_is_not_mapped_to_store_even_if_configured .HasColumnType("some_int_mapping"); Assert.Equal( - CoreStrings.PropertyNotMapped( - typeof(NonPrimitiveNonNavigationAsPropertyEntity).ShortDisplayName(), "LongProperty", - typeof(Tuple).ShortDisplayName()), + RelationalStrings.PropertyNotMapped( + typeof(Tuple).ShortDisplayName(), + typeof(NonPrimitiveNonNavigationAsPropertyEntity).ShortDisplayName(), + "LongProperty", + "some_int_mapping"), Assert.Throws(() => Validate(modelBuilder)).Message); } } diff --git a/test/EFCore.Relational.Tests/Infrastructure/RelationalModelValidatorTest.cs b/test/EFCore.Relational.Tests/Infrastructure/RelationalModelValidatorTest.cs index add186ec9a9..f4764b2bcad 100644 --- a/test/EFCore.Relational.Tests/Infrastructure/RelationalModelValidatorTest.cs +++ b/test/EFCore.Relational.Tests/Infrastructure/RelationalModelValidatorTest.cs @@ -32,7 +32,7 @@ public override void Detects_key_property_which_cannot_be_compared() }); VerifyError( - CoreStrings.PropertyNotMapped(nameof(WithNonComparableKey), nameof(WithNonComparableKey.Id), nameof(NotComparable)), + CoreStrings.PropertyNotMapped(nameof(NotComparable), nameof(WithNonComparableKey), nameof(WithNonComparableKey.Id)), modelBuilder); } @@ -47,7 +47,7 @@ public override void Detects_unique_index_property_which_cannot_be_compared() VerifyError( CoreStrings.PropertyNotMapped( - nameof(WithNonComparableUniqueIndex), nameof(WithNonComparableUniqueIndex.Index), nameof(NotComparable)), + nameof(NotComparable), nameof(WithNonComparableUniqueIndex), nameof(WithNonComparableUniqueIndex.Index)), modelBuilder); } @@ -64,7 +64,7 @@ public override void Ignores_normal_property_which_cannot_be_compared() VerifyError( CoreStrings.PropertyNotMapped( - nameof(WithNonComparableNormalProperty), nameof(WithNonComparableNormalProperty.Foo), nameof(NotComparable)), + nameof(NotComparable), nameof(WithNonComparableNormalProperty), nameof(WithNonComparableNormalProperty.Foo)), modelBuilder); } diff --git a/test/EFCore.Tests/ChangeTracking/ChangeTrackerTest.cs b/test/EFCore.Tests/ChangeTracking/ChangeTrackerTest.cs index 3582079735d..81bf6ab0d87 100644 --- a/test/EFCore.Tests/ChangeTracking/ChangeTrackerTest.cs +++ b/test/EFCore.Tests/ChangeTracking/ChangeTrackerTest.cs @@ -326,7 +326,59 @@ public async Task Keys_generated_on_behalf_of_a_principal_are_not_saved(bool asy Assert.Equal( CoreStrings.UnknownKeyValue(nameof(Weak), nameof(Weak.HeroId)), - Assert.Throws(() => context.SaveChanges()).Message); + (await Assert.ThrowsAsync( + async () => _ = async ? await context.SaveChangesAsync() : context.SaveChanges())) + .Message); + } + + [ConditionalTheory] + [InlineData(false)] + [InlineData(true)] + public async Task Attached_owned_entity_without_owner_not_saved(bool async) + { + using var context = new WeakHerosContext(); + + if (async) + { + await context.AddAsync(new Skinner()); + } + else + { + context.Add(new Skinner()); + } + + Assert.True(context.ChangeTracker.HasChanges()); + + Assert.Equal( + CoreStrings.SaveOwnedWithoutOwner(nameof(Skinner)), + (await Assert.ThrowsAsync( + async () => _ = async ? await context.SaveChangesAsync() : context.SaveChanges())) + .Message); + } + + [ConditionalTheory] + [InlineData(false)] + [InlineData(true)] + public async Task Attached_owned_collection_entity_without_owner_not_saved(bool async) + { + using var context = new WeakHerosContext(); + + if (async) + { + await context.AddAsync(new TheStreets()); + } + else + { + context.Add(new TheStreets()); + } + + Assert.True(context.ChangeTracker.HasChanges()); + + Assert.Equal( + CoreStrings.SaveOwnedWithoutOwner(nameof(TheStreets)), + (await Assert.ThrowsAsync( + async () => _ = async ? await context.SaveChangesAsync() : context.SaveChanges())) + .Message); } public class Hero @@ -343,16 +395,40 @@ public class Weak public Hero Hero { get; set; } } + public class Mike + { + public Guid Id { get; set; } + public ICollection TheStreets { get; set; } + public Skinner TheHero { get; set; } + } + + public class Skinner + { + } + + public class TheStreets + { + } + public class WeakHerosContext : DbContext { protected internal override void OnModelCreating(ModelBuilder modelBuilder) - => modelBuilder.Entity( + { + modelBuilder.Entity( b => { b.HasKey(e => new { e.Id, e.HeroId }); b.HasOne(e => e.Hero).WithMany(e => e.Weaks).HasForeignKey(e => e.HeroId); }); + modelBuilder.Entity( + b => + { + b.OwnsOne(e => e.TheHero); + b.OwnsMany(e => e.TheStreets); + }); + } + protected internal override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) => optionsBuilder.UseInMemoryDatabase(nameof(WeakHerosContext)); } diff --git a/test/EFCore.Tests/Infrastructure/ModelValidatorTest.PropertyMapping.cs b/test/EFCore.Tests/Infrastructure/ModelValidatorTest.PropertyMapping.cs index 9d2fc6f1cbe..b6358c9cec8 100644 --- a/test/EFCore.Tests/Infrastructure/ModelValidatorTest.PropertyMapping.cs +++ b/test/EFCore.Tests/Infrastructure/ModelValidatorTest.PropertyMapping.cs @@ -27,9 +27,9 @@ public virtual void Throws_when_added_property_is_not_of_primitive_type() Assert.Equal( CoreStrings.PropertyNotMapped( + typeof(NavigationAsProperty).ShortDisplayName(), typeof(NonPrimitiveAsPropertyEntity).ShortDisplayName(), - nameof(NonPrimitiveAsPropertyEntity.Property), - typeof(NavigationAsProperty).ShortDisplayName()), + nameof(NonPrimitiveAsPropertyEntity.Property)), Assert.Throws(() => Validate(modelBuilder)).Message); } diff --git a/test/EFCore.Tests/Metadata/Conventions/ConstructorBindingConventionTest.cs b/test/EFCore.Tests/Metadata/Conventions/ConstructorBindingConventionTest.cs index 5278e1e3093..1fd086f4328 100644 --- a/test/EFCore.Tests/Metadata/Conventions/ConstructorBindingConventionTest.cs +++ b/test/EFCore.Tests/Metadata/Conventions/ConstructorBindingConventionTest.cs @@ -680,16 +680,18 @@ public void Throws_if_no_usable_constructor() { var constructors = new[] { - CoreStrings.ConstructorBindingFailed("did", "BlogNone(string title, int did)"), - CoreStrings.ConstructorBindingFailed("notTitle", "BlogNone(string notTitle, Guid? shadow, int id)"), - CoreStrings.ConstructorBindingFailed("dummy", "BlogNone(string title, Guid? shadow, bool dummy, int id)"), - CoreStrings.ConstructorBindingFailed( + " " + CoreStrings.ConstructorBindingFailed("did", "BlogNone(string title, int did)"), + " " + CoreStrings.ConstructorBindingFailed("notTitle", "BlogNone(string notTitle, Guid? shadow, int id)"), + " " + CoreStrings.ConstructorBindingFailed("dummy", "BlogNone(string title, Guid? shadow, bool dummy, int id)"), + " " + CoreStrings.ConstructorBindingFailed( "dummy', 'description", "BlogNone(string title, Guid? shadow, bool dummy, int id, string description)") }; Assert.Equal( - CoreStrings.ConstructorNotFound(nameof(BlogNone), string.Join("; ", constructors)), + CoreStrings.ConstructorNotFound( + nameof(BlogNone), + Environment.NewLine + string.Join(Environment.NewLine, constructors) + Environment.NewLine), Assert.Throws(() => GetBinding()).Message); } @@ -718,7 +720,10 @@ public void Throws_if_no_usable_constructor_due_to_bad_type() Assert.Equal( CoreStrings.ConstructorNotFound( nameof(BlogBadType), - CoreStrings.ConstructorBindingFailed("shadow", "BlogBadType(Guid shadow, int id)")), + Environment.NewLine + + " " + + CoreStrings.ConstructorBindingFailed("shadow", "BlogBadType(Guid shadow, int id)") + + Environment.NewLine), Assert.Throws(() => GetBinding()).Message); } diff --git a/test/EFCore.Tests/Metadata/Internal/EntityMaterializerSourceTest.cs b/test/EFCore.Tests/Metadata/Internal/EntityMaterializerSourceTest.cs index 4d7a67d1e9c..d98ce1a8566 100644 --- a/test/EFCore.Tests/Metadata/Internal/EntityMaterializerSourceTest.cs +++ b/test/EFCore.Tests/Metadata/Internal/EntityMaterializerSourceTest.cs @@ -314,9 +314,12 @@ public void Throws_if_parameterless_constructor_is_not_defined_on_entity_type() Assert.Equal( CoreStrings.ConstructorNotFound( - typeof(EntityWithoutParameterlessConstructor).Name, "cannot bind 'value' in 'EntityWithoutParameterlessConstructor(int value)'"), - Assert.Throws( - () => modelBuilder.FinalizeModel()).Message); + nameof(EntityWithoutParameterlessConstructor), + Environment.NewLine + + " " + + CoreStrings.ConstructorBindingFailed("value", "EntityWithoutParameterlessConstructor(int value)") + + Environment.NewLine), + Assert.Throws(() => modelBuilder.FinalizeModel()).Message); } protected virtual ModelBuilder CreateConventionalModelBuilder(bool sensitiveDataLoggingEnabled = false) diff --git a/test/EFCore.Tests/ModelBuilding/NonRelationshipTestBase.cs b/test/EFCore.Tests/ModelBuilding/NonRelationshipTestBase.cs index 7ce85a89d5e..e115c2b47c6 100644 --- a/test/EFCore.Tests/ModelBuilding/NonRelationshipTestBase.cs +++ b/test/EFCore.Tests/ModelBuilding/NonRelationshipTestBase.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Dynamic; @@ -1012,7 +1011,9 @@ public virtual void Value_converter_configured_on_base_type_is_not_applied() modelBuilder.Entity(); Assert.Equal(CoreStrings.PropertyNotMapped( - nameof(WrappedStringEntity), nameof(WrappedStringEntity.WrappedString), nameof(WrappedString)), + nameof(WrappedString), + nameof(WrappedStringEntity), + nameof(WrappedStringEntity.WrappedString)), Assert.Throws(() => modelBuilder.FinalizeModel()).Message); }