From c607c018f0f8ace403ae782c151682ed66903ee6 Mon Sep 17 00:00:00 2001 From: Shay Rojansky Date: Wed, 6 Nov 2024 16:12:01 +0100 Subject: [PATCH] Fix error around mapping Nullable Fixes #2977 --- .../Metadata/Conventions/NpgsqlJsonElementHackConvention.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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))); }