/// <summary> /// returns properties including coming from base. /// </summary> /// <param name="entityType"></param> /// <returns></returns> public PropertyInfo[] GetAllProperties(Type entityType) { if (AllPropertiesCache.ContainsKey(entityType)) { return(AllPropertiesCache[entityType]); } var fields = entityType.GetProperties(); var properFields = new List <PropertyInfo>(); for (var i = 0; i < fields.Length; i++) { var propertyInfo = fields[i]; if (!propertyInfo.PropertyType.IsPublic) { continue; } if (!_typeLookup.HasDbType(propertyInfo.PropertyType)) { continue; } properFields.Add(propertyInfo); } var propertyInfos = properFields.ToArray(); AllPropertiesCache.Add(entityType, propertyInfos); return(propertyInfos); }
public PropertyInfo[] GetAllProperties(Type entityType) { if (AllPropertiesCache.ContainsKey(entityType)) { return(AllPropertiesCache[entityType]); } var fields = entityType.GetProperties() .Where(x => x.PropertyType.IsPublic && (_typeLookup.HasDbType(x.PropertyType) || x.PropertyType.BaseType == typeof(BaseEntity))).ToArray(); AllPropertiesCache.Add(entityType, fields); return(fields); }