internal static List <string> GetColumnStrings(MetaShare.Common.Core.Entities.Common newEntity, ICollection <string> keys) { List <string> allKeys = new List <string>(); if (newEntity != null) { Type type = newEntity.GetType(); PropertyInfo[] propertyInfos = type.GetProperties(BindingFlags.Instance | BindingFlags.GetProperty | BindingFlags.Public); foreach (string key in keys) { string newKey = string.Empty; foreach (PropertyInfo propertyInfo in propertyInfos) { if (propertyInfo.Name.ToLower().Equals(key.ToLower())) { newKey = key; if (!propertyInfo.PropertyType.IsPrimitive && propertyInfo.PropertyType != typeof(string) && !propertyInfo.PropertyType.IsEnum) { MetaShare.Common.Core.Entities.Common relatedEntity = Activator.CreateInstance(propertyInfo.PropertyType) as MetaShare.Common.Core.Entities.Common; if (relatedEntity != null) { newKey = key + "Id"; } } } } if (!string.IsNullOrEmpty(newKey)) { allKeys.Add(newKey); } } } return(allKeys); }