diff --git a/src/EFCore.PG/Metadata/Conventions/NpgsqlJsonElementHackConvention.cs b/src/EFCore.PG/Metadata/Conventions/NpgsqlJsonElementHackConvention.cs index df2fb162a..dad88135f 100644 --- a/src/EFCore.PG/Metadata/Conventions/NpgsqlJsonElementHackConvention.cs +++ b/src/EFCore.PG/Metadata/Conventions/NpgsqlJsonElementHackConvention.cs @@ -21,7 +21,7 @@ public void ProcessPropertyAdded(IConventionPropertyBuilder propertyBuilder, ICo { var property = propertyBuilder.Metadata; - if (property.ClrType == typeof(JsonElement) && property.GetColumnType() is null) + if (property.ClrType.UnwrapNullableType() == typeof(JsonElement) && property.GetColumnType() is null) { property.SetTypeMapping(_jsonTypeMapping ??= new NpgsqlJsonTypeMapping("jsonb", typeof(JsonElement))); }