From 899868d8f9aa11921999e29f0d5a2f7c4abcd79f Mon Sep 17 00:00:00 2001 From: Shay Rojansky Date: Thu, 31 Oct 2024 12:10:37 +0100 Subject: [PATCH] Fix arrays over user-defined ranges (#3342) Fixes #3137 --- .../Storage/Internal/Mapping/NpgsqlArrayTypeMapping.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EFCore.PG/Storage/Internal/Mapping/NpgsqlArrayTypeMapping.cs b/src/EFCore.PG/Storage/Internal/Mapping/NpgsqlArrayTypeMapping.cs index 052d653e4..a336b1148 100644 --- a/src/EFCore.PG/Storage/Internal/Mapping/NpgsqlArrayTypeMapping.cs +++ b/src/EFCore.PG/Storage/Internal/Mapping/NpgsqlArrayTypeMapping.cs @@ -190,7 +190,7 @@ protected NpgsqlArrayTypeMapping(RelationalTypeMappingParameters parameters) // Otherwise let the ADO.NET layer infer the PostgreSQL type. We can't always let it infer, otherwise // when given a byte[] it will infer byte (but we want smallint[]) NpgsqlDbType = NpgsqlTypes.NpgsqlDbType.Array - | (ElementTypeMapping is INpgsqlTypeMapping elementNpgsqlTypeMapping + | (ElementTypeMapping is INpgsqlTypeMapping { NpgsqlDbType: not NpgsqlTypes.NpgsqlDbType.Unknown } elementNpgsqlTypeMapping ? elementNpgsqlTypeMapping.NpgsqlDbType : ElementTypeMapping.DbType.HasValue ? new NpgsqlParameter { DbType = ElementTypeMapping.DbType.Value }.NpgsqlDbType