public List <TEntity> Set <TEntity>() where TEntity : class { var propertyInfo = PropertyInfos.FirstOrDefault(p => p.PropertyType == typeof(List <TEntity>)); if (propertyInfo != null) { // Get the List<T> from 'this' Context instance var x = propertyInfo.GetValue(this, null) as List <TEntity>; return(x); } throw new Exception("Type collection not found"); }
public void DeletePropertyInfos(ICollection <int> aPropertyInfoIdCollection) { if (PropertyInfos != null && PropertyInfos.Count > 0) { if (aPropertyInfoIdCollection != null && aPropertyInfoIdCollection.Count > 0) { foreach (var item in aPropertyInfoIdCollection) { var removeItem = PropertyInfos.FirstOrDefault(p => p.UId == item); if (removeItem != null) { PropertyInfos.Remove(removeItem); } } } } }
public void AddOrUpdatePropertyInfos(ICollection <PropertyInfo> aPropertyInfoCollection) { if (aPropertyInfoCollection != null && aPropertyInfoCollection.Count > 0) { foreach (var item in aPropertyInfoCollection) { var existItem = PropertyInfos.FirstOrDefault(p => p.UId == item.UId); if (existItem == null) { PropertyInfos.Add(item); } else { existItem.Update(item.PropertyId, item.PropertyValueIds); } } } }
private PropertyInfo GetPropertyInfoForOrderedList(string colunmName) { PropertyInfo propertyInfo; return(AttributeToPropInfoMapping.TryGetValue(colunmName, out propertyInfo) ? propertyInfo : PropertyInfos.FirstOrDefault(info => String.Equals(info.Name, NamingConvention.ProcessDbNamesToObjectNames(colunmName), StringComparison.CurrentCultureIgnoreCase))); }