From 158ea7128e1ce3de18a7ef1effa534dce1c602b7 Mon Sep 17 00:00:00 2001 From: bluedoctor <45383850@qq.com> Date: Tue, 3 May 2022 22:03:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8ESOD=E5=90=8C=E6=AD=A5=E4=BF=AE?= =?UTF-8?q?=E6=94=B9SOD.NET5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CommUtil/DelegatedReflectionMemberAccessor.cs | 4 +++- src/SOD.NET5/Lib/PWMIS.SOD.Core/Entity/EntityBase.cs | 12 +++++++++++- src/SOD.NET5/Lib/PWMIS.SOD.Core/Entity/OQL.cs | 4 ++-- .../Lib/PWMIS.SOD.Core/PWMIS.SOD.Core.csproj | 3 ++- .../CommUtil/DelegatedReflectionMemberAccessor.cs | 4 +++- src/SOD/Lib/PWMIS.Core/Entity/EntityBase.cs | 12 +++++++++++- src/SOD/Lib/PWMIS.Core/Entity/OQL.cs | 4 ++-- src/SOD/Lib/PWMIS.Core/Properties/AssemblyInfo.cs | 2 +- src/SOD/Tools/PDFDotNET/PDFDotNET.vbproj | 2 +- src/SOD/Tools/PDFDotNET/app.config | 2 +- src/SOD/Tools/PDFDotNET/packages.config | 2 +- 11 files changed, 38 insertions(+), 13 deletions(-) diff --git a/src/SOD.NET5/Lib/PWMIS.SOD.Core/CommUtil/DelegatedReflectionMemberAccessor.cs b/src/SOD.NET5/Lib/PWMIS.SOD.Core/CommUtil/DelegatedReflectionMemberAccessor.cs index 579fea0f..25fe4132 100644 --- a/src/SOD.NET5/Lib/PWMIS.SOD.Core/CommUtil/DelegatedReflectionMemberAccessor.cs +++ b/src/SOD.NET5/Lib/PWMIS.SOD.Core/CommUtil/DelegatedReflectionMemberAccessor.cs @@ -137,7 +137,9 @@ private INamedMemberAccessor FindAccessor(Type type, string memberName,bool thro return null; } accessor = Activator.CreateInstance(typeof(PropertyAccessor<,>).MakeGenericType(type, propertyInfo.PropertyType), type, memberName) as INamedMemberAccessor; - accessorCache.Add(key, accessor); + //下面一行在多线程环境下可能会出错,直接使用索引器不会出错。edit by bluedoctor,2022-5-3 + //accessorCache.Add(key, accessor); + accessorCache[key] = accessor; } return accessor; diff --git a/src/SOD.NET5/Lib/PWMIS.SOD.Core/Entity/EntityBase.cs b/src/SOD.NET5/Lib/PWMIS.SOD.Core/Entity/EntityBase.cs index 23000176..cd11ff28 100644 --- a/src/SOD.NET5/Lib/PWMIS.SOD.Core/Entity/EntityBase.cs +++ b/src/SOD.NET5/Lib/PWMIS.SOD.Core/Entity/EntityBase.cs @@ -1262,7 +1262,17 @@ public int MapToPOCO(object pocoClass) object Value = this.PropertyValues[i]; if (Value != null && Value != DBNull.Value) { - accessors[i].SetValue(pocoClass, this.PropertyValues[i]); + try + { + //属性名相同,但是类型不相同,可能出现转换错误。下面捕获异常给出明确提示。edit by bluedoctor,2022-5-3 + accessors[i].SetValue(pocoClass, this.PropertyValues[i]); + } + catch (Exception ex) + { + string errMsg = string.Format("尝试给对象{0} 的属性{1} 设置值的时候错误,详细请见内部错误。实体类同名属性的值:{2}", pocoClass.ToString(), PropertyNames[i], this.PropertyValues[i]); + Exception ex1 = new Exception(errMsg, ex); + throw ex1; + } count++; } } diff --git a/src/SOD.NET5/Lib/PWMIS.SOD.Core/Entity/OQL.cs b/src/SOD.NET5/Lib/PWMIS.SOD.Core/Entity/OQL.cs index 4f17bd35..0cd57581 100644 --- a/src/SOD.NET5/Lib/PWMIS.SOD.Core/Entity/OQL.cs +++ b/src/SOD.NET5/Lib/PWMIS.SOD.Core/Entity/OQL.cs @@ -1084,7 +1084,7 @@ public static OQL From(OQL parent, EntityBase e) /// /// /// users=OQL.From.ToList(); + /// List users=OQL.From.ToList(); /// ]]> /// /// @@ -1108,7 +1108,7 @@ public static GOQL FromObject() where T : class /// /// /// users=OQL.From.ToList(); + /// List users=OQL.From.ToList(); /// ]]> /// /// diff --git a/src/SOD.NET5/Lib/PWMIS.SOD.Core/PWMIS.SOD.Core.csproj b/src/SOD.NET5/Lib/PWMIS.SOD.Core/PWMIS.SOD.Core.csproj index b0b1e654..b074e25c 100644 --- a/src/SOD.NET5/Lib/PWMIS.SOD.Core/PWMIS.SOD.Core.csproj +++ b/src/SOD.NET5/Lib/PWMIS.SOD.Core/PWMIS.SOD.Core.csproj @@ -1,7 +1,7 @@  - netstandard2.0;.NET5.0 + netstandard2.0 6.0.0 SOD框架支持.NET 5以及之后的版本迁移升级的版本 PWMIS.COM @@ -9,6 +9,7 @@ PWMIS.SOD.Core深蓝医生 9.0 + 6.0.5.3 diff --git a/src/SOD/Lib/PWMIS.Core/CommUtil/DelegatedReflectionMemberAccessor.cs b/src/SOD/Lib/PWMIS.Core/CommUtil/DelegatedReflectionMemberAccessor.cs index 579fea0f..25fe4132 100644 --- a/src/SOD/Lib/PWMIS.Core/CommUtil/DelegatedReflectionMemberAccessor.cs +++ b/src/SOD/Lib/PWMIS.Core/CommUtil/DelegatedReflectionMemberAccessor.cs @@ -137,7 +137,9 @@ private INamedMemberAccessor FindAccessor(Type type, string memberName,bool thro return null; } accessor = Activator.CreateInstance(typeof(PropertyAccessor<,>).MakeGenericType(type, propertyInfo.PropertyType), type, memberName) as INamedMemberAccessor; - accessorCache.Add(key, accessor); + //下面一行在多线程环境下可能会出错,直接使用索引器不会出错。edit by bluedoctor,2022-5-3 + //accessorCache.Add(key, accessor); + accessorCache[key] = accessor; } return accessor; diff --git a/src/SOD/Lib/PWMIS.Core/Entity/EntityBase.cs b/src/SOD/Lib/PWMIS.Core/Entity/EntityBase.cs index bcc9b4a3..a71bbc67 100644 --- a/src/SOD/Lib/PWMIS.Core/Entity/EntityBase.cs +++ b/src/SOD/Lib/PWMIS.Core/Entity/EntityBase.cs @@ -1195,7 +1195,17 @@ public int MapToPOCO(object pocoClass) object Value = this.PropertyValues[i]; if (Value != null && Value != DBNull.Value) { - accessors[i].SetValue(pocoClass, this.PropertyValues[i]); + try + { + //属性名相同,但是类型不相同,可能出现转换错误。下面捕获异常给出明确提示。edit by bluedoctor,2022-5-3 + accessors[i].SetValue(pocoClass, this.PropertyValues[i]); + } + catch (Exception ex) + { + string errMsg = string.Format("尝试给对象{0} 的属性{1} 设置值的时候错误,详细请见内部错误。实体类同名属性的值:{2}", pocoClass.ToString(), PropertyNames[i], this.PropertyValues[i]); + Exception ex1 = new Exception(errMsg, ex); + throw ex1; + } count++; } } diff --git a/src/SOD/Lib/PWMIS.Core/Entity/OQL.cs b/src/SOD/Lib/PWMIS.Core/Entity/OQL.cs index 1d85a3f5..4f0f569c 100644 --- a/src/SOD/Lib/PWMIS.Core/Entity/OQL.cs +++ b/src/SOD/Lib/PWMIS.Core/Entity/OQL.cs @@ -1083,7 +1083,7 @@ public static OQL From(OQL parent, EntityBase e) /// /// /// users=OQL.From.ToList(); + /// List users=OQL.From().ToList(); /// ]]> /// /// @@ -1107,7 +1107,7 @@ public static GOQL FromObject() where T : class /// /// /// users=OQL.From.ToList(); + /// List users=OQL.From().ToList(); /// ]]> /// /// diff --git a/src/SOD/Lib/PWMIS.Core/Properties/AssemblyInfo.cs b/src/SOD/Lib/PWMIS.Core/Properties/AssemblyInfo.cs index e36ebf84..1613c997 100644 --- a/src/SOD/Lib/PWMIS.Core/Properties/AssemblyInfo.cs +++ b/src/SOD/Lib/PWMIS.Core/Properties/AssemblyInfo.cs @@ -33,4 +33,4 @@ // 方法是按如下所示使用“*”: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("5.6.2.0212")] -[assembly: AssemblyFileVersion("5.6.4.0903")] +[assembly: AssemblyFileVersion("5.6.5.0503")] diff --git a/src/SOD/Tools/PDFDotNET/PDFDotNET.vbproj b/src/SOD/Tools/PDFDotNET/PDFDotNET.vbproj index a2cab6c3..f2c8969c 100644 --- a/src/SOD/Tools/PDFDotNET/PDFDotNET.vbproj +++ b/src/SOD/Tools/PDFDotNET/PDFDotNET.vbproj @@ -15,7 +15,7 @@ PDFDotNET 512 WindowsForms - v4.6.2 + v4.6.1 On Binary Off diff --git a/src/SOD/Tools/PDFDotNET/app.config b/src/SOD/Tools/PDFDotNET/app.config index 567f8621..da83d634 100644 --- a/src/SOD/Tools/PDFDotNET/app.config +++ b/src/SOD/Tools/PDFDotNET/app.config @@ -31,7 +31,7 @@ - + diff --git a/src/SOD/Tools/PDFDotNET/packages.config b/src/SOD/Tools/PDFDotNET/packages.config index 7f80b9c2..28979fc6 100644 --- a/src/SOD/Tools/PDFDotNET/packages.config +++ b/src/SOD/Tools/PDFDotNET/packages.config @@ -3,5 +3,5 @@ - + \ No newline at end of file