Ejemplo n.º 1
0
        /// <summary>
        /// Raises the <see cref="ConfigurationNode.ChildAdded"/> event and sets the name of the cache storage based on the child <see cref="CacheStorageNode"/>.
        /// </summary>
        /// <param name="e">A <see cref="ConfigurationChangedEventArgs"/> that contains the event data.</param>
        protected override void OnChildAdded(ConfigurationNodeChangedEventArgs e)
        {
            base.OnChildAdded(e);
            CacheStorageNode node = e.Node as CacheStorageNode;

            Debug.Assert(null != node, "Only CacheStorageNode objects can be added to a CacheManagerNode");

            cacheStorageName = node.Name;
        }
Ejemplo n.º 2
0
        private void BuildCacheManagers()
        {
            foreach (CacheManagerNode managerNode in hierarchy.FindNodesByType(cacheSettingsNode, typeof(CacheManagerNode)))
            {
                CacheManagerData cacheManagerData      = managerNode.CacheManagerData;
                CacheStorageNode storageNodeForManager = (CacheStorageNode)hierarchy.FindNodeByType(managerNode, typeof(CacheStorageNode));
                cacheManagerData.CacheStorage = (storageNodeForManager == null) ? Resources.NullStorageName : storageNodeForManager.Name;

                if (cacheManagerData.CacheStorage == Resources.NullStorageName && !cacheConfiguration.BackingStores.Contains(Resources.NullStorageName))
                {
                    cacheConfiguration.BackingStores.Add(new CacheStorageData(Resources.NullStorageName, typeof(NullBackingStore)));
                }

                cacheConfiguration.CacheManagers.Add(cacheManagerData);
            }
        }