Exemple #1
0
        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");
        }
Exemple #2
0
 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);
                 }
             }
         }
     }
 }
Exemple #3
0
 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);
             }
         }
     }
 }
Exemple #4
0
        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)));
        }