From 9a0d1ba3789a503233767b9a46fa580b732c40a3 Mon Sep 17 00:00:00 2001 From: tengfei8771 <532050072@qq.com> Date: Wed, 14 Jun 2023 14:44:45 +0800 Subject: [PATCH 1/3] =?UTF-8?q?1.=E4=BF=AE=E6=AD=A3KdbndpParameter?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E5=A4=84=E7=90=86Iterator=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SqlSugar/Abstract/AdoProvider/AdoProvider.cs | 2 +- Src/Asp.NetCore2/SqlSugar/Utilities/ValidateExtensions.cs | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Src/Asp.NetCore2/SqlSugar/Abstract/AdoProvider/AdoProvider.cs b/Src/Asp.NetCore2/SqlSugar/Abstract/AdoProvider/AdoProvider.cs index e9ace4cd4..8e0a39ce3 100644 --- a/Src/Asp.NetCore2/SqlSugar/Abstract/AdoProvider/AdoProvider.cs +++ b/Src/Asp.NetCore2/SqlSugar/Abstract/AdoProvider/AdoProvider.cs @@ -1606,7 +1606,7 @@ namespace SqlSugar if (item.Value != null) { var type = item.Value.GetType(); - if ((type != UtilConstants.ByteArrayType && type.IsArray&&item.IsArray==false) || type.FullName.IsCollectionsList()) + if ((type != UtilConstants.ByteArrayType && type.IsArray&&item.IsArray==false) || type.FullName.IsCollectionsList()||type.IsIterator()) { var newValues = new List(); foreach (var inValute in item.Value as IEnumerable) diff --git a/Src/Asp.NetCore2/SqlSugar/Utilities/ValidateExtensions.cs b/Src/Asp.NetCore2/SqlSugar/Utilities/ValidateExtensions.cs index 8ae5209a0..68a093aff 100644 --- a/Src/Asp.NetCore2/SqlSugar/Utilities/ValidateExtensions.cs +++ b/Src/Asp.NetCore2/SqlSugar/Utilities/ValidateExtensions.cs @@ -153,6 +153,14 @@ namespace SqlSugar { return (thisValue + "").StartsWith("System.Collections.Generic.List")|| (thisValue + "").StartsWith("System.Collections.Generic.IEnumerable"); } + public static bool IsIterator(this Type type) + { + if (type.BaseType.IsGenericType) + { + return type.BaseType.GetGenericTypeDefinition().FullName == "System.Linq.Enumerable+Iterator`1"; + } + return false; + } public static bool IsStringArray(this string thisValue) { return (thisValue + "").IsMatch(@"System\.[a-z,A-Z,0-9]+?\[\]"); From 5e8bbb54bab76ce89158452582e29730fd7fcef7 Mon Sep 17 00:00:00 2001 From: tengfei8771 <532050072@qq.com> Date: Wed, 14 Jun 2023 15:00:40 +0800 Subject: [PATCH 2/3] =?UTF-8?q?1.=E5=AE=8C=E5=96=84=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Src/Asp.NetCore2/SqlSugar/Utilities/ValidateExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Src/Asp.NetCore2/SqlSugar/Utilities/ValidateExtensions.cs b/Src/Asp.NetCore2/SqlSugar/Utilities/ValidateExtensions.cs index 68a093aff..9bdf780fc 100644 --- a/Src/Asp.NetCore2/SqlSugar/Utilities/ValidateExtensions.cs +++ b/Src/Asp.NetCore2/SqlSugar/Utilities/ValidateExtensions.cs @@ -157,7 +157,7 @@ namespace SqlSugar { if (type.BaseType.IsGenericType) { - return type.BaseType.GetGenericTypeDefinition().FullName == "System.Linq.Enumerable+Iterator`1"; + return type.BaseType?.GetGenericTypeDefinition()?.FullName == "System.Linq.Enumerable+Iterator`1"; } return false; } From 5ea43e5321a27eedd6b4df278b26c5f92728107e Mon Sep 17 00:00:00 2001 From: tengfei8771 <532050072@qq.com> Date: Wed, 14 Jun 2023 15:05:30 +0800 Subject: [PATCH 3/3] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E5=88=A4=E6=96=ADbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Src/Asp.NetCore2/SqlSugar/Utilities/ValidateExtensions.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Src/Asp.NetCore2/SqlSugar/Utilities/ValidateExtensions.cs b/Src/Asp.NetCore2/SqlSugar/Utilities/ValidateExtensions.cs index 9bdf780fc..975f0aa97 100644 --- a/Src/Asp.NetCore2/SqlSugar/Utilities/ValidateExtensions.cs +++ b/Src/Asp.NetCore2/SqlSugar/Utilities/ValidateExtensions.cs @@ -155,6 +155,10 @@ namespace SqlSugar } public static bool IsIterator(this Type type) { + if (type.BaseType == null) + { + return false; + } if (type.BaseType.IsGenericType) { return type.BaseType?.GetGenericTypeDefinition()?.FullName == "System.Linq.Enumerable+Iterator`1";