From 08535786f1f079d15f6a353f47111f4ca97b11a9 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Sun, 26 Mar 2023 12:34:26 +0800 Subject: [PATCH] Update pgsql array type --- .../Abstract/UpdateProvider/UpdateableHelper.cs | 16 ++++++++++++++++ .../Realization/PostgreSQL/PostgreSQLProvider.cs | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableHelper.cs b/Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableHelper.cs index f7ba54fa2..10f08fb68 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableHelper.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableHelper.cs @@ -402,6 +402,22 @@ namespace SqlSugar if (item.IsArray) { parameter.IsArray = true; + if (item.PropertyType.IsIn(typeof(Guid[]), typeof(Guid?[]))) + { + parameter.DbType = System.Data.DbType.Guid; + } + else if (item.PropertyType.IsIn(typeof(int[]), typeof(int?[]))) + { + parameter.DbType = System.Data.DbType.Int32; + } + else if (item.PropertyType.IsIn(typeof(long[]), typeof(long?[]))) + { + parameter.DbType = System.Data.DbType.Int64; + } + else if (item.PropertyType.IsIn(typeof(short[]), typeof(short?[]))) + { + parameter.DbType = System.Data.DbType.Int16; + } } if (item.Value == null && isDic) { diff --git a/Src/Asp.Net/SqlSugar/Realization/PostgreSQL/PostgreSQLProvider.cs b/Src/Asp.Net/SqlSugar/Realization/PostgreSQL/PostgreSQLProvider.cs index 582f6a474..2a4dd87ae 100644 --- a/Src/Asp.Net/SqlSugar/Realization/PostgreSQL/PostgreSQLProvider.cs +++ b/Src/Asp.Net/SqlSugar/Realization/PostgreSQL/PostgreSQLProvider.cs @@ -177,6 +177,10 @@ namespace SqlSugar { sqlParameter.NpgsqlDbType = NpgsqlDbType.Bigint | NpgsqlDbType.Array; } + else if (parameter.DbType.IsIn(System.Data.DbType.Guid)) + { + sqlParameter.NpgsqlDbType = NpgsqlDbType.Uuid | NpgsqlDbType.Array; + } else { sqlParameter.NpgsqlDbType = NpgsqlDbType.Text | NpgsqlDbType.Array;