Skip to content

Commit

Permalink
SqlDb.Utils - bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
cattaneoinfoesse committed Jul 25, 2022
1 parent 5236f52 commit 62ebed2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
1 change: 0 additions & 1 deletion ACUtils.Logger/ACUtils.Logger.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

<ItemGroup>
<PackageReference Include="Serilog" Version="2.10.0" />
<PackageReference Include="System.Diagnostics.EventLog" Version="6.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
Expand Down
4 changes: 2 additions & 2 deletions ACUtils.SqlDb.Utils/ACUtils.SqlDb.Utils.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<Authors>Andrea Cattaneo</Authors>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<Version>1.0.0.141</Version>
<PackageVersion>1.0.0.141</PackageVersion>
<Version>1.0.0.142</Version>
<PackageVersion>1.0.0.142</PackageVersion>
<Description>Utilities per gestione DataTable</Description>
<NeutralLanguage>it</NeutralLanguage>
<IncludeSymbols>true</IncludeSymbols>
Expand Down
9 changes: 7 additions & 2 deletions ACUtils.SqlDb.Utils/DBModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,19 +202,24 @@ public virtual void idrate(IDataRecord dataRecord)

}

protected void setValue(string key, object value, Type colType = null)
protected virtual void setValue(string key, object value, Type colType = null)
{
var property = this.GetType().GetProperty(key);
var sourceType = value?.GetType();
var targetType = property.PropertyType;

if (!property.CanWrite) return;
if (!property.CanWrite)
return;

// NULL value
if (value == DBNull.Value || value == null)
{
property.SetValue(this, null);
}
else if (targetType.IsAssignableFrom(sourceType))
{
property.SetValue(this, value);
}
// boolean
else if (targetType == typeof(bool) || targetType == typeof(bool?))
{
Expand Down
4 changes: 2 additions & 2 deletions ACUtils.SqlDb/ACUtils.SqlDb.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<Authors>Andrea Cattaneo</Authors>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<Version>1.0.0.141</Version>
<PackageVersion>1.0.0.141</PackageVersion>
<Version>1.0.0.142</Version>
<PackageVersion>1.0.0.142</PackageVersion>
<Description>Utility per interrogazione database MSSQL</Description>
<NeutralLanguage>it</NeutralLanguage>
<IncludeSymbols>true</IncludeSymbols>
Expand Down

0 comments on commit 62ebed2

Please sign in to comment.