示例#1
0
        public override WildcardRouteItem GetWildcardRouteForLinkProvider(Item item, SiteContext site)
        {
            Assert.ArgumentNotNull(item, "item");
            string cacheKey = $"cache{item.TemplateID}_{item.Language.Name}_{site.Name}";

            if (LinkProviderRoutesCache.ContainsKey(cacheKey))
            {
                return(LinkProviderRoutesCache[cacheKey]);
            }

            WildcardRouteItem route = Routes?.FirstOrDefault(x => x.ItemTemplates.Contains(new TemplateID(item.TemplateID)));

            if (route == null)
            {
                return(null);
            }

            LinkProviderRoutesCache.TryAdd(cacheKey, route);

            return(route);
        }
示例#2
0
        public override WildcardRouteItem GetWildcardRouteForItemResolver(Item item, SiteContext site)
        {
            Assert.ArgumentNotNull(item, "item");
            string cacheKey = $"cache{item.ID}_{item.Language.Name}_{site.Name}";

            if (ItemResolverRoutesCache.ContainsKey(cacheKey))
            {
                return(ItemResolverRoutesCache[cacheKey]);
            }

            WildcardRouteItem route = Routes?.FirstOrDefault(x => x.WildcardItemIds.Contains(item.ID));

            if (route == null)
            {
                return(null);
            }

            ItemResolverRoutesCache.TryAdd(cacheKey, route);

            return(route);
        }