Skip to content

Commit

Permalink
bump System.Data.SqlClient and code refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
acattaneo-bitagora committed Feb 28, 2024
1 parent 273e349 commit 0ee8758
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
6 changes: 3 additions & 3 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.148</Version>
<PackageVersion>1.0.0.148</PackageVersion>
<Version>1.0.0.149</Version>
<PackageVersion>1.0.0.149</PackageVersion>
<Description>Utilities per gestione DataTable</Description>
<NeutralLanguage>it</NeutralLanguage>
<IncludeSymbols>true</IncludeSymbols>
Expand All @@ -16,7 +16,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ACUtils.StringUtils\ACUtils.StringUtils.csproj" />
Expand Down
15 changes: 10 additions & 5 deletions ACUtils.SqlDb.Utils/DBModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public Q GetValueByDbAttribute<Q>(string field)
{
return GetValueBy<Q>(field, property => GetDbAttribute(property.Name)?.DbField);
}

public object this[string fieldName]
{
get
Expand Down Expand Up @@ -174,7 +174,8 @@ public virtual void idrate(IDataRecord dataRecord)
var coltype = dataRecord.GetFieldType(i);
var colvalue = dataRecord[i];
setValue(property.Name, colvalue, coltype);
}else
}
else
{
var attr = GetDbAttribute(property.Name);
if (attr?.DbField == null) continue;
Expand Down Expand Up @@ -292,14 +293,18 @@ public bool HasDbField(string field)

public IDbFieldAttribute GetDbAttribute(string propertyName)
{
var propr = GetType().GetProperty(propertyName);
var attrs = propr.GetCustomAttributes(typeof(IDbFieldAttribute), true);
return attrs.LastOrDefault() as IDbFieldAttribute;
var type = GetType();
return GetDbAttribute(type, propertyName);
}

public static IDbFieldAttribute GetDbAttribute<T>(string propertyName)
{
var type = typeof(T);
return GetDbAttribute(type, propertyName);
}

public static IDbFieldAttribute GetDbAttribute(Type type, string propertyName)
{
var propr = type.GetProperty(propertyName);
var attrs = propr?.GetCustomAttributes(typeof(IDbFieldAttribute), true);
return attrs?.LastOrDefault() as IDbFieldAttribute;
Expand Down
6 changes: 3 additions & 3 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.155</Version>
<PackageVersion>1.0.0.155</PackageVersion>
<Version>1.0.0.156</Version>
<PackageVersion>1.0.0.156</PackageVersion>
<Description>Utility per interrogazione database MSSQL</Description>
<NeutralLanguage>it</NeutralLanguage>
<IncludeSymbols>true</IncludeSymbols>
Expand All @@ -15,7 +15,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions ACUtils.SqlDbExt/ACUtils.SqlDbExt.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.143</Version>
<PackageVersion>1.0.0.143</PackageVersion>
<Version>1.0.0.144</Version>
<PackageVersion>1.0.0.144</PackageVersion>
<Description>Utility per interrogazione database MSSQL</Description>
<NeutralLanguage>it</NeutralLanguage>
<IncludeSymbols>true</IncludeSymbols>
Expand All @@ -15,7 +15,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
<PackageReference Include="CsvHelper" Version="15.0.5" />
</ItemGroup>

Expand Down

0 comments on commit 0ee8758

Please sign in to comment.