- 优化 实体类重写属性 new 如果类型与基类不一致,无法使用的问题;

This commit is contained in:
28810
2019-11-10 12:18:16 +08:00
parent 5ce037d316
commit 8a9a50ecb7
8 changed files with 48 additions and 20 deletions

View File

@@ -79,11 +79,10 @@ namespace FreeSql.Internal.CommonProvider
if (isThrowException) throw e;
}
internal static ConcurrentDictionary<Type, Dictionary<string, PropertyInfo>> dicQueryTypeGetProperties = new ConcurrentDictionary<Type, Dictionary<string, PropertyInfo>>();
internal Dictionary<string, PropertyInfo> GetQueryTypeProperties(Type type)
{
var tb = _util.GetTableByEntity(type);
var props = tb?.Properties ?? dicQueryTypeGetProperties.GetOrAdd(type, k => type.GetProperties().ToDictionary(a => a.Name, a => a, StringComparer.CurrentCultureIgnoreCase));
var props = tb?.Properties ?? type.GetPropertiesDictIgnoreCase();
return props;
}
public List<T> Query<T>(string cmdText, object parms = null) => Query<T>(null, null, CommandType.Text, cmdText, GetDbParamtersByObject(cmdText, parms));