コード例 #1
0
        /// <summary>
        /// Gets the catalog nodes dto.
        /// </summary>
        /// <param name="assetKey">The asset key.</param>
        /// <returns></returns>
        internal static CatalogRelationDto GetCatalogRelationDto(string assetKey)
        {
            // Assign new cache key, specific for site guid and response groups requested
            string cacheKey = CatalogCache.CreateCacheKey("catalog-relation-asset", assetKey);

            CatalogRelationDto dto = null;

            // check cache first
            object cachedObject = CatalogCache.Get(cacheKey);

            if (cachedObject != null)
            {
                dto = (CatalogRelationDto)cachedObject;
            }

            // Load the object
            if (dto == null)
            {
                CatalogRelationAdmin admin = new CatalogRelationAdmin();
                admin.LoadAsset(assetKey);
                dto = admin.CurrentDto;

                // Insert to the cache collection
                CatalogCache.Insert(cacheKey, dto, CatalogConfiguration.Instance.Cache.CatalogCollectionTimeout);
            }

            dto.AcceptChanges();

            return(dto);
        }
コード例 #2
0
        /// <summary>
        /// Gets the catalog nodes dto.
        /// </summary>
        /// <param name="catalogId">The catalog id.</param>
        /// <param name="catalogNodeId">The catalog node id.</param>
        /// <param name="catalogEntryId">The catalog entry id.</param>
        /// <param name="groupName">Name of the group.</param>
        /// <param name="responseGroup">The response group.</param>
        /// <returns></returns>
        internal static CatalogRelationDto GetCatalogRelationDto(int catalogId, int catalogNodeId, int catalogEntryId, string groupName, CatalogRelationResponseGroup responseGroup)
        {
            // Assign new cache key, specific for site guid and response groups requested
            string cacheKey = CatalogCache.CreateCacheKey("catalog-relation", responseGroup.CacheKey, catalogId.ToString(), catalogNodeId.ToString(), catalogEntryId.ToString(), groupName);

            CatalogRelationDto dto = null;

            // check cache first
            object cachedObject = CatalogCache.Get(cacheKey);

            if (cachedObject != null)
            {
                dto = (CatalogRelationDto)cachedObject;
            }

            // Load the object
            if (dto == null)
            {
                CatalogRelationAdmin admin = new CatalogRelationAdmin();
                admin.Load(catalogId, catalogNodeId, catalogEntryId, groupName, responseGroup.ResponseGroups.GetHashCode());
                dto = admin.CurrentDto;

                // Insert to the cache collection
                CatalogCache.Insert(cacheKey, dto, CatalogConfiguration.Instance.Cache.CatalogCollectionTimeout);
            }

            dto.AcceptChanges();

            return(dto);
        }