예제 #1
0
        public static IEnumerable <string> GetFreeCacheDependencies(string storedProcedureName)
        {
            FreeCacheSpDependencies freeCacheSpDependencies = ConfigurationExtensions.GetFreeCacheSpDependencies(storedProcedureName);

            if (freeCacheSpDependencies == null)
            {
                return(null);
            }
            return(freeCacheSpDependencies.Dependencies);
        }
        private static MSLivingChoices.Configuration.ConfigurationEntities.MsSqlCache.MsSqlCache GetMsSqlCacheData()
        {
            object            obj;
            CacheItemPriority cacheItemPriority;

            MSLivingChoices.Configuration.ConfigurationEntities.MsSqlCache.MsSqlCache msSqlCache = null;
            if (MSLivingChoices.Configuration.ConfigurationManager.GetSection("msSqlCache", out obj))
            {
                MsSqlCacheSection msSqlCacheSection = (MsSqlCacheSection)obj;
                msSqlCache = new MSLivingChoices.Configuration.ConfigurationEntities.MsSqlCache.MsSqlCache();
                foreach (CachedDataSpElement cachedDataDependencyMap in msSqlCacheSection.CachedDataDependencyMap)
                {
                    CachedDataSpDependencies cachedDataSpDependency = new CachedDataSpDependencies()
                    {
                        StoredProcedureName = cachedDataDependencyMap.Name
                    };
                    foreach (CachedDataDependencyElement dependency in cachedDataDependencyMap.Dependencies)
                    {
                        cachedDataSpDependency.Dependencies.Add(dependency.Table);
                    }
                    if (!Enum.TryParse <CacheItemPriority>(cachedDataDependencyMap.Priority, true, out cacheItemPriority))
                    {
                        cacheItemPriority = CacheItemPriority.Normal;
                    }
                    cachedDataSpDependency.Priority = cacheItemPriority;
                    msSqlCache.CachedDataDependencyMap.Add(cachedDataSpDependency);
                }
                foreach (FreeCacheSpElement freeCacheDependencyMap in msSqlCacheSection.FreeCacheDependencyMap)
                {
                    FreeCacheSpDependencies freeCacheSpDependency = new FreeCacheSpDependencies()
                    {
                        StoredProcedureName = freeCacheDependencyMap.Name
                    };
                    foreach (FreeCacheDependencyElement freeCacheDependencyElement in freeCacheDependencyMap.Dependencies)
                    {
                        freeCacheSpDependency.Dependencies.Add(freeCacheDependencyElement.StoredProcedure);
                    }
                    msSqlCache.FreeCacheDependencyMap.Add(freeCacheSpDependency);
                }
            }
            return(msSqlCache);
        }