Gets inbound routing working, reduces the amount of non injected dependencies, reduces the amount of DomainHelper instances

This commit is contained in:
Shannon
2018-04-24 13:07:18 +10:00
parent 48641166b9
commit 9044c9328d
57 changed files with 582 additions and 423 deletions

View File

@@ -31,7 +31,8 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
XmlStore xmlStore, // an XmlStore containing the master xml
IDomainCache domainCache, // an IDomainCache implementation
ICacheProvider cacheProvider, // an ICacheProvider that should be at request-level
IGlobalSettings globalSettings,
IGlobalSettings globalSettings,
ISiteDomainHelper siteDomainHelper,
PublishedContentTypeCache contentTypeCache, // a PublishedContentType cache
RoutesCache routesCache, // a RoutesCache
string previewToken) // a preview token string (or null if not previewing)
@@ -42,7 +43,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
_routesCache = routesCache; // may be null for unit-testing
_contentTypeCache = contentTypeCache;
_domainCache = domainCache;
_domainHelper = new DomainHelper(_domainCache);
_domainHelper = new DomainHelper(_domainCache, siteDomainHelper);
_xmlStore = xmlStore;
_xml = _xmlStore.Xml; // capture - because the cache has to remain consistent
@@ -63,7 +64,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
#region Routes
public virtual IPublishedContent GetByRoute(bool preview, string route, bool? hideTopLevelNode = null)
public virtual IPublishedContent GetByRoute(bool preview, string route, bool? hideTopLevelNode = null, CultureInfo culture = null)
{
if (route == null) throw new ArgumentNullException(nameof(route));
@@ -107,12 +108,12 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
_routesCache.Store(content.Id, route, true); // trusted route
}
public IPublishedContent GetByRoute(string route, bool? hideTopLevelNode = null)
public IPublishedContent GetByRoute(string route, bool? hideTopLevelNode = null, CultureInfo culture = null)
{
return GetByRoute(PreviewDefault, route, hideTopLevelNode);
}
public virtual string GetRouteById(bool preview, int contentId, string language = null)
public virtual string GetRouteById(bool preview, int contentId, CultureInfo culture = null)
{
// try to get from cache if not previewing
var route = preview || _routesCache == null ? null : _routesCache.GetRoute(contentId);
@@ -137,9 +138,9 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
return route;
}
public string GetRouteById(int contentId, string language = null)
public string GetRouteById(int contentId, CultureInfo culture = null)
{
return GetRouteById(PreviewDefault, contentId, language);
return GetRouteById(PreviewDefault, contentId, culture);
}
IPublishedContent DetermineIdByRoute(bool preview, string route, bool hideTopLevelNode)