예제 #1
0
        public void FindIndex(string indexKey, object[] propertyValues, Action <string> action)
        {
            EntityIndexList indexList = new EntityIndexList();

            if (_entityIndexDict != null && _entityIndexDict.ContainsKey(indexKey) && _entityIndexDict[indexKey] != null)
            {
                indexList = _entityIndexDict[indexKey];
            }
            string      indexItemKey = BaseEntity.CreateKeyCode(propertyValues);
            EntityIndex entityIndex  = indexList[indexItemKey];//当没有indexKey对应键值时,entityIndex为空

            if (entityIndex != null)
            {
                entityIndex.Foreach(action);
            }
            //TraceLog.Write("获得索引对象为空,缓存实体类:{0},索引键:{1},字典项Key:{2},字典容量:{3}",_cachekey, indexKey, indexItemKey, indexList.Count);
        }
예제 #2
0
        public void RemoveIndex(string indexKey, object[] propertyValues, string indexValue)
        {
            EntityIndexList indexList = new EntityIndexList();

            if (_entityIndexDict != null && _entityIndexDict.ContainsKey(indexKey) && _entityIndexDict[indexKey] != null)
            {
                indexList = _entityIndexDict[indexKey];
            }
            indexList.Remove(propertyValues, indexValue);

            if (_entityIndexDict != null && _entityIndexDict.ContainsKey(indexKey))
            {
                _entityIndexDict[indexKey] = indexList;
            }
            else if (_entityIndexDict != null)
            {
                _entityIndexDict.Add(indexKey, indexList);
            }
        }
예제 #3
0
        public void CreateIndex(string indexKey, object[] propertyValues, string indexValue)
        {
            if (_entityIndexDict == null)
            {
                throw new NullReferenceException(string.Format("索引{0}异常,索引字典对象为空!", indexKey));
            }
            EntityIndexList indexList = new EntityIndexList();
            if (_entityIndexDict != null && _entityIndexDict.ContainsKey(indexKey) && _entityIndexDict[indexKey] != null)
            {
                indexList = _entityIndexDict[indexKey];
            }
            indexList.Add(propertyValues, indexValue);

            if (_entityIndexDict != null && _entityIndexDict.ContainsKey(indexKey))
            {
                _entityIndexDict[indexKey] = indexList;
            }
            else if (_entityIndexDict != null)
            {
                _entityIndexDict.Add(indexKey, indexList);
            }
        }
예제 #4
0
        public void CreateIndex(string indexKey, object[] propertyValues, string indexValue)
        {
            if (_entityIndexDict == null)
            {
                throw new NullReferenceException(string.Format("索引{0}异常,索引字典对象为空!", indexKey));
            }
            EntityIndexList indexList = new EntityIndexList();

            if (_entityIndexDict != null && _entityIndexDict.ContainsKey(indexKey) && _entityIndexDict[indexKey] != null)
            {
                indexList = _entityIndexDict[indexKey];
            }
            indexList.Add(propertyValues, indexValue);

            if (_entityIndexDict != null && _entityIndexDict.ContainsKey(indexKey))
            {
                _entityIndexDict[indexKey] = indexList;
            }
            else if (_entityIndexDict != null)
            {
                _entityIndexDict.Add(indexKey, indexList);
            }
        }
예제 #5
0
 public void FindIndex(string indexKey, object[] propertyValues, Action<string> action)
 {
     EntityIndexList indexList = new EntityIndexList();
     if (_entityIndexDict != null && _entityIndexDict.ContainsKey(indexKey) && _entityIndexDict[indexKey] != null)
     {
         indexList = _entityIndexDict[indexKey];
     }
     string indexItemKey = BaseEntity.CreateKeyCode(propertyValues);
     EntityIndex entityIndex = indexList[indexItemKey];//当没有indexKey对应键值时,entityIndex为空
     if (entityIndex != null)
     {
         entityIndex.Foreach(action);
     }
     //TraceLog.Write("获得索引对象为空,缓存实体类:{0},索引键:{1},字典项Key:{2},字典容量:{3}",_cachekey, indexKey, indexItemKey, indexList.Count);
 }
예제 #6
0
        public void RemoveIndex(string indexKey, object[] propertyValues, string indexValue)
        {
            EntityIndexList indexList = new EntityIndexList();
            if (_entityIndexDict != null && _entityIndexDict.ContainsKey(indexKey) && _entityIndexDict[indexKey] != null)
            {
                indexList = _entityIndexDict[indexKey];
            }
            indexList.Remove(propertyValues, indexValue);

            if (_entityIndexDict != null && _entityIndexDict.ContainsKey(indexKey))
            {
                _entityIndexDict[indexKey] = indexList;
            }
            else if (_entityIndexDict != null)
            {
                _entityIndexDict.Add(indexKey, indexList);
            }
        }