コード例 #1
0
        public virtual LookupItemCollection GetLookups(string collectionName)
        {
            cacheLock.EnterUpgradeableReadLock();
            try {
                Dictionary <string, LookupItemCollection> cachedItems = new Dictionary <string, LookupItemCollection>();
                if (CacheProvider.Contains(this.Name))
                {
                    cachedItems = CacheProvider.Read(this.Name) as Dictionary <string, LookupItemCollection>;
                }

                if (cachedItems.ContainsKey(collectionName))
                {
                    return(cachedItems[collectionName]);
                }
                else
                {
                    cacheLock.EnterWriteLock();
                    try {
                        LookupItemCollection result = InitializeLookups(collectionName);

                        cachedItems.Add(collectionName, result);
                        CacheProvider.Update(this.Name, cachedItems);
                        return(result);
                    } finally  {
                        cacheLock.ExitWriteLock();
                    }
                }
            } finally {
                cacheLock.ExitUpgradeableReadLock();
            }
        }
コード例 #2
0
 public abstract void SaveLookups(LookupItemCollection lookups);