diff --git a/Falcon.ModelSP/DataExtend.cs b/Falcon.ModelSP/DataExtend.cs index 9389bea..9e1ca78 100644 --- a/Falcon.ModelSP/DataExtend.cs +++ b/Falcon.ModelSP/DataExtend.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Reflection; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; - +using System; namespace Falcon.ModelSP { @@ -109,7 +109,7 @@ namespace Falcon.ModelSP for(var i = 0;i < columnSchema.Count;i++) { var name = dr.GetName(i); var value = dr.IsDBNull(i) ? null : dr.GetValue(i); - var pi = typeof(TR).GetProperty(name); + var pi = getProperty(name); if(pi == null || !pi.CanWrite) continue; pi.SetValue(item,value); @@ -120,6 +120,17 @@ namespace Falcon.ModelSP return result; } } - + /// + /// 忽略大小写获取类型的属性 + /// + private static PropertyInfo getProperty(string name) { + var type = typeof(T); + foreach(var item in type.GetProperties()) { + if(item.Name.ToLower() == name.ToLower()) { + return item; + } + } + return null; + } } }