/// <summary> /// Constructor used to create a new handler for multi-tenency with domains and ids /// </summary> /// <param name="umbracoUrlProvider"></param> /// <param name="itemsForRoute"></param> public ArticulateVirtualNodeByIdRouteHandler(UrlProvider umbracoUrlProvider, IEnumerable <IPublishedContent> itemsForRoute) { foreach (var publishedContent in itemsForRoute) { var allUrls = ArticulateRoutes.GetContentUrls(umbracoUrlProvider, publishedContent); foreach (var url in allUrls) { //if there is a double slash, it will have a domain if (url.Contains("//")) { var uri = new Uri(url, UriKind.Absolute); _hostsAndIds.Add(new Tuple <string, int>(uri.Host, publishedContent.Id)); } else { _hostsAndIds.Add(new Tuple <string, int>(string.Empty, publishedContent.Id)); } } LogHelper.Debug <ArticulateVirtualNodeByIdRouteHandler>(() => $"Hosts/IDs map for node {publishedContent.Id}. Values: {DebugHostIdsCollection()}"); } }
public TagsOrCategoryPathRouteConstraint(UrlProvider umbracoUrlProvider, IEnumerable <IPublishedContent> itemsForRoute) { if (itemsForRoute == null) { throw new ArgumentNullException(nameof(itemsForRoute)); } foreach (var node in itemsForRoute) { var allUrls = ArticulateRoutes.GetContentUrls(umbracoUrlProvider, node); foreach (var url in allUrls) { //if there is a double slash, it will have a domain if (url.Contains("//")) { var uri = new Uri(url, UriKind.Absolute); _urlNames.Add(new UrlNames { Host = uri.Host, CategoryUrlName = node.GetPropertyValue <string>("categoriesUrlName"), TagsUrlName = node.GetPropertyValue <string>("tagsUrlName") }); } else { _urlNames.Add(new UrlNames { Host = string.Empty, CategoryUrlName = node.GetPropertyValue <string>("categoriesUrlName"), TagsUrlName = node.GetPropertyValue <string>("tagsUrlName") }); } } } }