Пример #1
0
 public Sys_sysProperty GetPropertyById(int propertyId)
 {
     lock (_lockObj)
     {
         if (_cachePropertyDic.ContainsKey(propertyId))
         {
             return(_cachePropertyDic[propertyId]);
         }
         Sys_sysProperty entityByKey = base.Session.GetEntityByKey <Sys_sysProperty>((object)propertyId, true);
         if (entityByKey == null)
         {
             return(null);
         }
         if (_cachePropertyIdList.Count > 100)
         {
             int key = _cachePropertyIdList[0];
             _cachePropertyIdList.RemoveAt(0);
             if (_cachePropertyDic.ContainsKey(key))
             {
                 _cachePropertyDic.Remove(key);
             }
         }
         _cachePropertyIdList.Add(entityByKey.Id);
         _cachePropertyDic[entityByKey.Id] = entityByKey;
         return(entityByKey);
     }
 }
Пример #2
0
        public static IList <Sys_sysProperty> GetPropertyAllTopLevelProperty(string propertyId)
        {
            IList <Sys_sysProperty> list = new List <Sys_sysProperty>();

            while (true)
            {
                Sys_sysProperty parentPropertyEntity = GetPropertyById(DataConvert.ToInt(propertyId));
                if (parentPropertyEntity == null)
                {
                    break;
                }
                list.Add(parentPropertyEntity);
                if (parentPropertyEntity.Parentid == 0)
                {
                    break;
                }
                propertyId = DataConvert.ToString((object)parentPropertyEntity.Parentid);
            }
            return(list);
        }