Skip to content

Commit

Permalink
与SOD同步修改SOD.NET5
Browse files Browse the repository at this point in the history
  • Loading branch information
bluedoctor committed May 3, 2022
1 parent 69c23d6 commit 158ea71
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 11 additions & 1 deletion src/SOD.NET5/Lib/PWMIS.SOD.Core/Entity/EntityBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/SOD.NET5/Lib/PWMIS.SOD.Core/Entity/OQL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,7 @@ public static OQL From(OQL parent, EntityBase e)
/// <example>
/// <code>
/// <![CDATA[
/// List<User> users=OQL.From<User>.ToList();
/// List<IUser> users=OQL.From<IUser>.ToList();
/// ]]>
/// </code>
/// </example>
Expand All @@ -1108,7 +1108,7 @@ public static GOQL<T> FromObject<T>() where T : class
/// <example>
/// <code>
/// <![CDATA[
/// List<User> users=OQL.From<User>.ToList<User>();
/// List<User> users=OQL.From<User>.ToList();
/// ]]>
/// </code>
/// </example>
Expand Down
3 changes: 2 additions & 1 deletion src/SOD.NET5/Lib/PWMIS.SOD.Core/PWMIS.SOD.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;.NET5.0</TargetFrameworks>
<TargetFramework>netstandard2.0</TargetFramework>
<Version>6.0.0</Version>
<Description>SOD框架支持.NET 5以及之后的版本迁移升级的版本</Description>
<Copyright>PWMIS.COM</Copyright>
<Company>PWMIS(程序员蜜糍)</Company>
<Authors>PWMIS.SOD.Core深蓝医生</Authors>
<NeutralLanguage></NeutralLanguage>
<LangVersion>9.0</LangVersion>
<AssemblyVersion>6.0.5.3</AssemblyVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 11 additions & 1 deletion src/SOD/Lib/PWMIS.Core/Entity/EntityBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/SOD/Lib/PWMIS.Core/Entity/OQL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,7 @@ public static OQL From(OQL parent, EntityBase e)
/// <example>
/// <code>
/// <![CDATA[
/// List<User> users=OQL.From<User>.ToList();
/// List<IUser> users=OQL.From<IUser>().ToList();
/// ]]>
/// </code>
/// </example>
Expand All @@ -1107,7 +1107,7 @@ public static GOQL<T> FromObject<T>() where T : class
/// <example>
/// <code>
/// <![CDATA[
/// List<User> users=OQL.From<User>.ToList<User>();
/// List<User> users=OQL.From<User>().ToList();
/// ]]>
/// </code>
/// </example>
Expand Down
2 changes: 1 addition & 1 deletion src/SOD/Lib/PWMIS.Core/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
2 changes: 1 addition & 1 deletion src/SOD/Tools/PDFDotNET/PDFDotNET.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<AssemblyName>PDFDotNET</AssemblyName>
<FileAlignment>512</FileAlignment>
<MyType>WindowsForms</MyType>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<OptionExplicit>On</OptionExplicit>
<OptionCompare>Binary</OptionCompare>
<OptionStrict>Off</OptionStrict>
Expand Down
2 changes: 1 addition & 1 deletion src/SOD/Tools/PDFDotNET/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<add key="HotWebSite" value="博客园|http://www.cnblogs.com ;CSDN|http://www.csdn.net;"/>
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
</startup>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
Expand Down
2 changes: 1 addition & 1 deletion src/SOD/Tools/PDFDotNET/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
<package id="cef.redist.x64" version="97.1.6" targetFramework="net462" />
<package id="cef.redist.x86" version="97.1.6" targetFramework="net462" />
<package id="CefSharp.Common" version="97.1.61" targetFramework="net462" />
<package id="CefSharp.WinForms" version="97.1.61" targetFramework="net462" />
<package id="CefSharp.WinForms" version="97.1.61" targetFramework="net462" requireReinstallation="true" />
</packages>

0 comments on commit 158ea71

Please sign in to comment.