diff --git a/ACUtils.SqlDb.Utils/ACUtils.SqlDb.Utils.csproj b/ACUtils.SqlDb.Utils/ACUtils.SqlDb.Utils.csproj index 2449e96..e8928be 100644 --- a/ACUtils.SqlDb.Utils/ACUtils.SqlDb.Utils.csproj +++ b/ACUtils.SqlDb.Utils/ACUtils.SqlDb.Utils.csproj @@ -4,8 +4,8 @@ Andrea Cattaneo true false - 1.0.0.148 - 1.0.0.148 + 1.0.0.149 + 1.0.0.149 Utilities per gestione DataTable it true @@ -16,7 +16,7 @@ - + diff --git a/ACUtils.SqlDb.Utils/DBModel.cs b/ACUtils.SqlDb.Utils/DBModel.cs index 22ce1ab..5003565 100644 --- a/ACUtils.SqlDb.Utils/DBModel.cs +++ b/ACUtils.SqlDb.Utils/DBModel.cs @@ -118,7 +118,7 @@ public Q GetValueByDbAttribute(string field) { return GetValueBy(field, property => GetDbAttribute(property.Name)?.DbField); } - + public object this[string fieldName] { get @@ -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; @@ -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(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; diff --git a/ACUtils.SqlDb/ACUtils.SqlDb.csproj b/ACUtils.SqlDb/ACUtils.SqlDb.csproj index 79e0234..d600f9b 100644 --- a/ACUtils.SqlDb/ACUtils.SqlDb.csproj +++ b/ACUtils.SqlDb/ACUtils.SqlDb.csproj @@ -5,8 +5,8 @@ Andrea Cattaneo true false - 1.0.0.155 - 1.0.0.155 + 1.0.0.156 + 1.0.0.156 Utility per interrogazione database MSSQL it true @@ -15,7 +15,7 @@ - + diff --git a/ACUtils.SqlDbExt/ACUtils.SqlDbExt.csproj b/ACUtils.SqlDbExt/ACUtils.SqlDbExt.csproj index bcd2163..d149565 100644 --- a/ACUtils.SqlDbExt/ACUtils.SqlDbExt.csproj +++ b/ACUtils.SqlDbExt/ACUtils.SqlDbExt.csproj @@ -5,8 +5,8 @@ Andrea Cattaneo true false - 1.0.0.143 - 1.0.0.143 + 1.0.0.144 + 1.0.0.144 Utility per interrogazione database MSSQL it true @@ -15,7 +15,7 @@ - +