Beispiel #1
0
 protected void RemoveNamedTag(object key, Hashtable value)
 {
     if (value != null)
     {
         string        str       = value["type"] as string;
         Hashtable     hashtable = value["named-tags-list"] as Hashtable;
         List <string> list      = new List <string>();
         foreach (string str2 in hashtable.Keys)
         {
             if (hashtable[str2] is string)
             {
                 list.Add(str2);
             }
         }
         foreach (string str3 in list)
         {
             hashtable[str3] = (hashtable[str3] as string).ToLower();
         }
         if (base.IndexMapInternal.ContainsKey(str))
         {
             IQueryIndex index = base.IndexMapInternal[str] as IQueryIndex;
             index.RemoveFromIndex(key, hashtable);
             if (((AttributeIndex)index).Size == 0)
             {
                 base.IndexMapInternal.Remove(str);
             }
         }
     }
 }
        public virtual void RemoveFromIndex(object key, object value)
        {
            if (value == null)
            {
                return;
            }
            CacheEntry entry = (CacheEntry)value;
            string     type  = entry.ObjectType;

            lock (_indexMap.SyncRoot)
            {
                IQueryIndex index    = (IQueryIndex)_indexMap[type];
                long        prevSize = index.IndexInMemorySize;
                index.RemoveFromIndex(key, value);
                this._queryIndexMemorySize += index.IndexInMemorySize - prevSize;
            }
        }
Beispiel #3
0
 public virtual void RemoveFromIndex(object key, string value)
 {
     if (value == null)
     {
         return;
     }
     lock (_indexMap.SyncRoot)
     {
         string type = value.ToString();
         if (_indexMap.Contains(type))
         {
             IQueryIndex index    = (IQueryIndex)_indexMap[type];
             long        prevSize = index.IndexInMemorySize;
             index.RemoveFromIndex(key);
             this._queryIndexMemorySize += index.IndexInMemorySize - prevSize;
         }
     }
 }
Beispiel #4
0
 /// <summary>
 /// Remove a tag do gerenciador.
 /// </summary>
 /// <param name="key"></param>
 /// <param name="value"></param>
 private void RemoveTag(object key, Hashtable value)
 {
     if (value != null)
     {
         string str  = value["type"] as string;
         var    list = value["tags-list"] as ArrayList;
         if (base.IndexMapInternal.ContainsKey(str))
         {
             IQueryIndex index = base.IndexMapInternal[str] as IQueryIndex;
             foreach (string str2 in list)
             {
                 Hashtable hashtable = new Hashtable();
                 hashtable["$Tag$"] = str2.ToLower();
                 index.RemoveFromIndex(key, hashtable);
             }
             if (((AttributeIndex)index).Size == 0)
             {
                 base.IndexMapInternal.Remove(str);
             }
         }
     }
 }
Beispiel #5
0
        public virtual void RemoveFromIndex(object key, object value)
        {
            if (value != null && ((Hashtable)value).Contains("query-info"))
            {
                value = ((Hashtable)value)["query-info"];
            }
            else
            {
                return;
            }

            lock (_indexMap.SyncRoot)
            {
                IDictionaryEnumerator queryInfoDic = ((Hashtable)value).GetEnumerator();
                while (queryInfoDic.MoveNext())
                {
                    int    handleId = (int)queryInfoDic.Key;
                    string type     = _typeMap.GetTypeName(handleId);
                    if (_indexMap.Contains(type))
                    {
                        Hashtable attribs = new Hashtable();
                        ArrayList values  = (ArrayList)queryInfoDic.Value;

                        ArrayList attribList = _typeMap.GetAttribList(handleId);

                        for (int i = 0; i < attribList.Count; i++)
                        {
                            string val = _typeMap.GetAttributes(handleId)[attribList[i]] as string;
                            Type   t1  = Type.GetType(val, true, true);
                            object obj = null;
                            if (values[i] != null)
                            {
                                try
                                {
                                    if (t1 == typeof(System.DateTime))
                                    {
                                        obj = new DateTime(Convert.ToInt64(values[i]));
                                    }
                                    else
                                    {
                                        obj = Convert.ChangeType(values[i], t1);
                                    }
                                }
                                catch (Exception)
                                {
                                    throw new System.FormatException("Cannot convert '" + values[i] + "' to " + t1.ToString());
                                }

                                string attribute = attribList[i].ToString();

                                if (obj != null && obj is string)
                                {
                                    attribs.Add(attribute, ((string)obj).ToLower());
                                }
                                else
                                {
                                    attribs.Add(attribute, obj);
                                }
                            }
                        }

                        IQueryIndex index    = (IQueryIndex)_indexMap[type];
                        long        prevSize = index.IndexInMemorySize;
                        index.RemoveFromIndex(key, attribs);
                        this._queryIndexMemorySize += index.IndexInMemorySize - prevSize;
                    }
                }
            }
        }