/// <summary>
 /// Initializes a new instance of the <see cref="TreeElementComparer"/> class.
 /// </summary>
 /// <param name="items">The items.</param>
 public OrganizationalUnitTreeComparer(List <EntityObject> items)
 {
     foreach (EntityObject item in items)
     {
         InnerDictionary.Add(item.PrimaryKeyId.Value, (DirectoryOrganizationalUnitEntity)item);
     }
 }
Ejemplo n.º 2
0
        /// <inheritdoc />
        public void Add(string key, object value)
        {
            if (key == null)
            {
                throw new ArgumentNullException(nameof(key));
            }

            EnsureWritable();
            InnerDictionary.Add(key, value);
        }
Ejemplo n.º 3
0
        public T3 Add(T1 value1, T2 value2, T3 value3)
        {
            if (!InnerDictionary.ContainsKey(value1))
            {
                InnerDictionary.Add(value1, new Dictionary <T2, T3>());
            }

            InnerDictionary[value1].Add(value2, value3);
            return(value3);
        }
 public void Add(string key, MethodParameterValue value)
 {
     InnerDictionary.Add(key, value);
     if (value != null)
     {
         value.SetOwner(this);
         if (_tracking)
         {
             ((IStateManager)value).TrackViewState();
         }
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// 向CacheQueue中增加一个有关联Dependency的Cache项,如果相应的key已经存在,则抛出异常
        /// </summary>
        /// <param name="key">键</param>
        /// <param name="data">值</param>
        /// <param name="dependency">依赖:相对时间依赖、绝对时间依赖、文件依赖或混合依赖</param>
        /// <returns>值</returns>
        /// <remarks>
        /// <code source="..\Framework\TestProjects\DeluxeWorks.Library.Test\Caching\CacheQueueTest.cs" region="AddRemoveClearTest" lang="cs" title="增加、移除、获取CacheItem项" />
        /// </remarks>
        public TValue Add(TKey key, TValue data, DependencyBase dependency)
        {
            this.rWLock.AcquireWriterLock(this.lockTimeout);
            try
            {
                InnerDictionary.MaxLength = this.MaxLength;

                //先删除已经存在而且过期的Cache项
                if (InnerDictionary.ContainsKey(key) &&
                    ((CacheItem <TKey, TValue>)InnerDictionary[key]).Dependency != null &&
                    ((CacheItem <TKey, TValue>)InnerDictionary[key]).Dependency.HasChanged)
                {
                    this.Remove(key);
                }

                CacheItem <TKey, TValue> item = new CacheItem <TKey, TValue>(key, data, dependency, this);

                if (dependency != null)
                {
                    dependency.UtcLastModified   = DateTime.UtcNow;
                    dependency.UtcLastAccessTime = DateTime.UtcNow;
                }

                if (this.overrideExistsItem)
                {
                    InnerDictionary[key] = item;
                }
                else
                {
                    InnerDictionary.Add(key, item);
                }

                this.Counters.EntriesCounter.RawValue = InnerDictionary.Count;

                return(data);
            }
            finally
            {
                this.rWLock.ReleaseWriterLock();
            }
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Adds an item to the LazyDictionary.
 /// </summary>
 /// <param name="item">The KeyValuePair object to add to the LazyDictionary.</param>
 public void Add(KeyValuePair <TKey, TValue> item)
 {
     InnerDictionary.Add(item);
 }
Ejemplo n.º 7
0
 /// <inheritdoc />
 public void Add(TKey key, TValue value)
 {
     using (writeLock.LockWrite())
         InnerDictionary.Add(key, value);
 }
Ejemplo n.º 8
0
 /// <inheritdoc />
 public void Add(KeyValuePair <TKey, TValue> item)
 {
     using (writeLock.LockWrite())
         InnerDictionary.Add(item);
 }