diff --git a/src/EFCore.Relational/Internal/RelationalPropertyExtensions.cs b/src/EFCore.Relational/Internal/RelationalPropertyExtensions.cs index 6dd5166f348..ee4c9a35440 100644 --- a/src/EFCore.Relational/Internal/RelationalPropertyExtensions.cs +++ b/src/EFCore.Relational/Internal/RelationalPropertyExtensions.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; @@ -26,6 +27,9 @@ public static string FormatColumns([NotNull] this IEnumerable propert /// directly from your code. This API may change or be removed in future releases. /// public static string GetConfiguredColumnType([NotNull] this IProperty property) - => (string)property[RelationalAnnotationNames.ColumnType]; + => AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Metadata.UseTypeMappingAlways", out var isPresent) + && isPresent + ? property.Relational().ColumnType + : (string)property[RelationalAnnotationNames.ColumnType]; } }