diff --git a/src/Umbraco.Core/Models/PublishedContent/IPublishedContent.cs b/src/Umbraco.Core/Models/PublishedContent/IPublishedContent.cs
index 6917538331..93487b6492 100644
--- a/src/Umbraco.Core/Models/PublishedContent/IPublishedContent.cs
+++ b/src/Umbraco.Core/Models/PublishedContent/IPublishedContent.cs
@@ -93,20 +93,6 @@ namespace Umbraco.Core.Models.PublishedContent
///
DateTime UpdateDate { get; }
- ///
- /// Gets the url of the content item.
- ///
- ///
- /// If the content item is a document, then this method returns the url of the
- /// document. If it is a media, then this methods return the media url for the
- /// 'umbracoFile' property. Use the MediaUrl() method to get the media url for other
- /// properties.
- /// The value of this property is contextual. It depends on the 'current' request uri,
- /// if any. In addition, when the content type is multi-lingual, this is the url for the
- /// specified culture. Otherwise, it is the invariant url.
- ///
- string Url(string culture = null, UrlMode mode = UrlMode.Auto);
-
///
/// Gets the culture date of the content item.
///
diff --git a/src/Umbraco.Core/Models/PublishedContent/PublishedContentWrapped.cs b/src/Umbraco.Core/Models/PublishedContent/PublishedContentWrapped.cs
index b2feec38c6..3da690a7e2 100644
--- a/src/Umbraco.Core/Models/PublishedContent/PublishedContentWrapped.cs
+++ b/src/Umbraco.Core/Models/PublishedContent/PublishedContentWrapped.cs
@@ -93,9 +93,6 @@ namespace Umbraco.Core.Models.PublishedContent
///
public virtual DateTime UpdateDate => _content.UpdateDate;
- ///
- public virtual string Url(string culture = null, UrlMode mode = UrlMode.Auto) => _content.Url(culture, mode);
-
///
public DateTime CultureDate(string culture = null) => _content.CultureDate(culture);
diff --git a/src/Umbraco.Tests/Cache/PublishedCache/PublishedContentCacheTests.cs b/src/Umbraco.Tests/Cache/PublishedCache/PublishedContentCacheTests.cs
index bb46b369c5..be160a483c 100644
--- a/src/Umbraco.Tests/Cache/PublishedCache/PublishedContentCacheTests.cs
+++ b/src/Umbraco.Tests/Cache/PublishedCache/PublishedContentCacheTests.cs
@@ -68,9 +68,9 @@ namespace Umbraco.Tests.Cache.PublishedCache
var appCache = new DictionaryAppCache();
var domainCache = new DomainCache(ServiceContext.DomainService, DefaultCultureAccessor);
var publishedShapshot = new PublishedSnapshot(
- new PublishedContentCache(xmlStore, domainCache, appCache, globalSettings, new SiteDomainHelper(), umbracoContextAccessor, ContentTypesCache, null, null),
+ new PublishedContentCache(xmlStore, domainCache, appCache, globalSettings, ContentTypesCache, null, null),
new PublishedMediaCache(xmlStore, ServiceContext.MediaService, ServiceContext.UserService, appCache, ContentTypesCache, Factory.GetInstance(), umbracoContextAccessor),
- new PublishedMemberCache(null, appCache, Current.Services.MemberService, ContentTypesCache, umbracoContextAccessor),
+ new PublishedMemberCache(null, appCache, Current.Services.MemberService, ContentTypesCache),
domainCache);
var publishedSnapshotService = new Mock();
publishedSnapshotService.Setup(x => x.CreatePublishedSnapshot(It.IsAny())).Returns(publishedShapshot);
diff --git a/src/Umbraco.Tests/Cache/PublishedCache/PublishedMediaCacheTests.cs b/src/Umbraco.Tests/Cache/PublishedCache/PublishedMediaCacheTests.cs
index bcd34ef2e3..d31401c725 100644
--- a/src/Umbraco.Tests/Cache/PublishedCache/PublishedMediaCacheTests.cs
+++ b/src/Umbraco.Tests/Cache/PublishedCache/PublishedMediaCacheTests.cs
@@ -323,8 +323,7 @@ namespace Umbraco.Tests.Cache.PublishedCache
// no xpath
null,
// not from examine
- false,
- _umbracoContextAccessor),
+ false),
//callback to get the children
(dd, n) => children,
// callback to get a property
@@ -334,8 +333,7 @@ namespace Umbraco.Tests.Cache.PublishedCache
// no xpath
null,
// not from examine
- false,
- _umbracoContextAccessor);
+ false);
return dicDoc;
}
diff --git a/src/Umbraco.Tests/LegacyXmlPublishedCache/DictionaryPublishedContent.cs b/src/Umbraco.Tests/LegacyXmlPublishedCache/DictionaryPublishedContent.cs
index 811851224c..3a39d23ccb 100644
--- a/src/Umbraco.Tests/LegacyXmlPublishedCache/DictionaryPublishedContent.cs
+++ b/src/Umbraco.Tests/LegacyXmlPublishedCache/DictionaryPublishedContent.cs
@@ -8,7 +8,6 @@ using Umbraco.Core;
using Umbraco.Core.Cache;
using Umbraco.Core.Logging;
using Umbraco.Core.Models.PublishedContent;
-using Umbraco.Web;
using Umbraco.Web.Composing;
using Umbraco.Web.Models;
using Umbraco.Web.PublishedCache;
@@ -40,9 +39,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
IAppCache appCache,
PublishedContentTypeCache contentTypeCache,
XPathNavigator nav,
- bool fromExamine,
- IUmbracoContextAccessor umbracoContextAccessor)
- :base(umbracoContextAccessor)
+ bool fromExamine)
{
if (valueDictionary == null) throw new ArgumentNullException(nameof(valueDictionary));
if (getParent == null) throw new ArgumentNullException(nameof(getParent));
diff --git a/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedContentCache.cs b/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedContentCache.cs
index 8b6ac372ec..33348d071a 100644
--- a/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedContentCache.cs
+++ b/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedContentCache.cs
@@ -9,7 +9,6 @@ using Umbraco.Core.Cache;
using Umbraco.Core.Configuration;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.Xml;
-using Umbraco.Web;
using Umbraco.Web.PublishedCache;
using Umbraco.Web.Routing;
@@ -19,7 +18,6 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
{
private readonly IAppCache _appCache;
private readonly IGlobalSettings _globalSettings;
- private readonly IUmbracoContextAccessor _umbracoContextAccessor;
private readonly RoutesCache _routesCache;
private readonly IDomainCache _domainCache;
private readonly PublishedContentTypeCache _contentTypeCache;
@@ -34,8 +32,6 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
IDomainCache domainCache, // an IDomainCache implementation
IAppCache appCache, // an IAppCache that should be at request-level
IGlobalSettings globalSettings,
- ISiteDomainHelper siteDomainHelper,
- IUmbracoContextAccessor umbracoContextAccessor,
PublishedContentTypeCache contentTypeCache, // a PublishedContentType cache
RoutesCache routesCache, // a RoutesCache
string previewToken) // a preview token string (or null if not previewing)
@@ -43,7 +39,6 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
{
_appCache = appCache;
_globalSettings = globalSettings;
- _umbracoContextAccessor = umbracoContextAccessor;
_routesCache = routesCache; // may be null for unit-testing
_contentTypeCache = contentTypeCache;
_domainCache = domainCache;
@@ -318,13 +313,13 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
private IPublishedContent ConvertToDocument(XmlNode xmlNode, bool isPreviewing)
{
- return xmlNode == null ? null : XmlPublishedContent.Get(xmlNode, isPreviewing, _appCache, _contentTypeCache,_umbracoContextAccessor);
+ return xmlNode == null ? null : XmlPublishedContent.Get(xmlNode, isPreviewing, _appCache, _contentTypeCache);
}
private IEnumerable ConvertToDocuments(XmlNodeList xmlNodes, bool isPreviewing)
{
return xmlNodes.Cast()
- .Select(xmlNode => XmlPublishedContent.Get(xmlNode, isPreviewing, _appCache, _contentTypeCache, _umbracoContextAccessor));
+ .Select(xmlNode => XmlPublishedContent.Get(xmlNode, isPreviewing, _appCache, _contentTypeCache));
}
#endregion
diff --git a/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedMediaCache.cs b/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedMediaCache.cs
index 7ebb026a21..ba43921f1c 100644
--- a/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedMediaCache.cs
+++ b/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedMediaCache.cs
@@ -674,8 +674,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
_appCache,
_contentTypeCache,
cacheValues.XPath, // though, outside of tests, that should be null
- cacheValues.FromExamine,
- _umbracoContextAccessor
+ cacheValues.FromExamine
);
return content.CreateModel();
}
diff --git a/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedMemberCache.cs b/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedMemberCache.cs
index c28575f83d..19328c241e 100644
--- a/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedMemberCache.cs
+++ b/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedMemberCache.cs
@@ -6,7 +6,6 @@ using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.Security;
using Umbraco.Core.Services;
-using Umbraco.Web;
using Umbraco.Web.PublishedCache;
using Umbraco.Web.Security;
@@ -18,16 +17,13 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
private readonly IAppCache _requestCache;
private readonly XmlStore _xmlStore;
private readonly PublishedContentTypeCache _contentTypeCache;
- private readonly IUmbracoContextAccessor _umbracoContextAccessor;
- public PublishedMemberCache(XmlStore xmlStore, IAppCache requestCache, IMemberService memberService,
- PublishedContentTypeCache contentTypeCache, IUmbracoContextAccessor umbracoContextAccessor)
+ public PublishedMemberCache(XmlStore xmlStore, IAppCache requestCache, IMemberService memberService, PublishedContentTypeCache contentTypeCache)
{
_requestCache = requestCache;
_memberService = memberService;
_xmlStore = xmlStore;
_contentTypeCache = contentTypeCache;
- _umbracoContextAccessor = umbracoContextAccessor;
}
public IPublishedContent GetByProviderKey(object key)
@@ -44,7 +40,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
var result = _memberService.GetByProviderKey(key);
if (result == null) return null;
var type = _contentTypeCache.Get(PublishedItemType.Member, result.ContentTypeId);
- return new PublishedMember(result, type, _umbracoContextAccessor).CreateModel();
+ return new PublishedMember(result, type).CreateModel();
});
}
@@ -62,7 +58,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
var result = _memberService.GetById(memberId);
if (result == null) return null;
var type = _contentTypeCache.Get(PublishedItemType.Member, result.ContentTypeId);
- return new PublishedMember(result, type, _umbracoContextAccessor).CreateModel();
+ return new PublishedMember(result, type).CreateModel();
});
}
@@ -80,7 +76,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
var result = _memberService.GetByUsername(username);
if (result == null) return null;
var type = _contentTypeCache.Get(PublishedItemType.Member, result.ContentTypeId);
- return new PublishedMember(result, type, _umbracoContextAccessor).CreateModel();
+ return new PublishedMember(result, type).CreateModel();
});
}
@@ -98,14 +94,14 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
var result = _memberService.GetByEmail(email);
if (result == null) return null;
var type = _contentTypeCache.Get(PublishedItemType.Member, result.ContentTypeId);
- return new PublishedMember(result, type, _umbracoContextAccessor).CreateModel();
+ return new PublishedMember(result, type).CreateModel();
});
}
public IPublishedContent GetByMember(IMember member)
{
var type = _contentTypeCache.Get(PublishedItemType.Member, member.ContentTypeId);
- return new PublishedMember(member, type, _umbracoContextAccessor).CreateModel();
+ return new PublishedMember(member, type).CreateModel();
}
public XPathNavigator CreateNavigator()
diff --git a/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedSnapshotService.cs b/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedSnapshotService.cs
index 4a201ae44c..394a33d777 100644
--- a/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedSnapshotService.cs
+++ b/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedSnapshotService.cs
@@ -145,9 +145,9 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
var domainCache = new DomainCache(_domainService, _defaultCultureAccessor);
return new PublishedSnapshot(
- new PublishedContentCache(_xmlStore, domainCache, _requestCache, _globalSettings, _siteDomainHelper,_umbracoContextAccessor, _contentTypeCache, _routesCache, previewToken),
+ new PublishedContentCache(_xmlStore, domainCache, _requestCache, _globalSettings, _contentTypeCache, _routesCache, previewToken),
new PublishedMediaCache(_xmlStore, _mediaService, _userService, _requestCache, _contentTypeCache, _entitySerializer, _umbracoContextAccessor),
- new PublishedMemberCache(_xmlStore, _requestCache, _memberService, _contentTypeCache, _umbracoContextAccessor),
+ new PublishedMemberCache(_xmlStore, _requestCache, _memberService, _contentTypeCache),
domainCache);
}
diff --git a/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlPublishedContent.cs b/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlPublishedContent.cs
index 7d24eec1e9..2edb2bae32 100644
--- a/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlPublishedContent.cs
+++ b/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlPublishedContent.cs
@@ -26,23 +26,19 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
XmlNode xmlNode,
bool isPreviewing,
IAppCache appCache,
- PublishedContentTypeCache contentTypeCache,
- IUmbracoContextAccessor umbracoContextAccessor)
- :base(umbracoContextAccessor)
+ PublishedContentTypeCache contentTypeCache)
{
_xmlNode = xmlNode;
_isPreviewing = isPreviewing;
_appCache = appCache;
_contentTypeCache = contentTypeCache;
- _umbracoContextAccessor = umbracoContextAccessor;
}
private readonly XmlNode _xmlNode;
private readonly bool _isPreviewing;
private readonly IAppCache _appCache; // at snapshot/request level (see PublishedContentCache)
private readonly PublishedContentTypeCache _contentTypeCache;
- private readonly IUmbracoContextAccessor _umbracoContextAccessor;
private readonly object _initializeLock = new object();
@@ -256,7 +252,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
if (parent == null) return;
if (parent.Attributes?.GetNamedItem("isDoc") != null)
- _parent = Get(parent, _isPreviewing, _appCache, _contentTypeCache, _umbracoContextAccessor);
+ _parent = Get(parent, _isPreviewing, _appCache, _contentTypeCache);
_parentInitialized = true;
}
@@ -413,7 +409,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
var iterator = nav.Select(expr);
_children = iterator.Cast()
- .Select(n => Get(((IHasXmlNode) n).GetNode(), _isPreviewing, _appCache, _contentTypeCache, _umbracoContextAccessor))
+ .Select(n => Get(((IHasXmlNode) n).GetNode(), _isPreviewing, _appCache, _contentTypeCache))
.OrderBy(x => x.SortOrder)
.ToList();
@@ -433,7 +429,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
/// sure that we create only one instance of each for the duration of a request. The
/// returned IPublishedContent is a model, if models are enabled.
public static IPublishedContent Get(XmlNode node, bool isPreviewing, IAppCache appCache,
- PublishedContentTypeCache contentTypeCache, IUmbracoContextAccessor umbracoContextAccessor)
+ PublishedContentTypeCache contentTypeCache)
{
// only 1 per request
@@ -441,7 +437,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
var id = attrs?.GetNamedItem("id").Value;
if (id.IsNullOrWhiteSpace()) throw new InvalidOperationException("Node has no ID attribute.");
var key = CacheKeyPrefix + id; // dont bother with preview, wont change during request in Xml cache
- return (IPublishedContent) appCache.Get(key, () => (new XmlPublishedContent(node, isPreviewing, appCache, contentTypeCache, umbracoContextAccessor)).CreateModel());
+ return (IPublishedContent) appCache.Get(key, () => (new XmlPublishedContent(node, isPreviewing, appCache, contentTypeCache)).CreateModel());
}
public static void ClearRequest()
diff --git a/src/Umbraco.Tests/Published/NestedContentTests.cs b/src/Umbraco.Tests/Published/NestedContentTests.cs
index 5e024c2a72..a1b736ae90 100644
--- a/src/Umbraco.Tests/Published/NestedContentTests.cs
+++ b/src/Umbraco.Tests/Published/NestedContentTests.cs
@@ -172,7 +172,7 @@ namespace Umbraco.Tests.Published
new TestPublishedProperty(contentType1.GetPropertyType("property1"), $@"[
{{ ""key"": ""{keyA}"", ""propertyN1"": ""foo"", ""ncContentTypeAlias"": ""contentN1"" }}
]")
- }, Mock.Of());
+ });
var value = content.Value("property1");
// nested single converter returns proper TestModel value
@@ -200,8 +200,7 @@ namespace Umbraco.Tests.Published
{{ ""key"": ""{keyA}"", ""propertyN1"": ""foo"", ""ncContentTypeAlias"": ""contentN1"" }},
{{ ""key"": ""{keyB}"", ""propertyN1"": ""bar"", ""ncContentTypeAlias"": ""contentN1"" }}
]")
- },
- Mock.Of());
+ });
var value = content.Value("property2");
// nested many converter returns proper IEnumerable value
@@ -261,7 +260,7 @@ namespace Umbraco.Tests.Published
class TestPublishedContent : PublishedContentBase
{
- public TestPublishedContent(IPublishedContentType contentType, Guid key, IEnumerable properties, IUmbracoContextAccessor umbracoContextAccessor): base(umbracoContextAccessor)
+ public TestPublishedContent(IPublishedContentType contentType, Guid key, IEnumerable properties)
{
ContentType = contentType;
Key = key;
diff --git a/src/Umbraco.Tests/PublishedContent/NuCacheTests.cs b/src/Umbraco.Tests/PublishedContent/NuCacheTests.cs
index 7d5fb8e736..dc035c1645 100644
--- a/src/Umbraco.Tests/PublishedContent/NuCacheTests.cs
+++ b/src/Umbraco.Tests/PublishedContent/NuCacheTests.cs
@@ -24,7 +24,6 @@ using Umbraco.Web.Cache;
using Umbraco.Web.PublishedCache;
using Umbraco.Web.PublishedCache.NuCache;
using Umbraco.Web.PublishedCache.NuCache.DataSource;
-using Umbraco.Web.Routing;
namespace Umbraco.Tests.PublishedContent
{
@@ -171,7 +170,6 @@ namespace Umbraco.Tests.PublishedContent
null,
new TestPublishedSnapshotAccessor(),
_variationAccesor,
- Mock.Of(),
Mock.Of(),
scopeProvider,
Mock.Of(),
@@ -180,7 +178,6 @@ namespace Umbraco.Tests.PublishedContent
new TestDefaultCultureAccessor(),
dataSource,
globalSettings,
- new SiteDomainHelper(),
Mock.Of(),
Mock.Of(),
new UrlSegmentProviderCollection(new[] { new DefaultUrlSegmentProvider() }));
diff --git a/src/Umbraco.Tests/Routing/MediaUrlProviderTests.cs b/src/Umbraco.Tests/Routing/MediaUrlProviderTests.cs
index 268e4e9d85..9eee6eb32d 100644
--- a/src/Umbraco.Tests/Routing/MediaUrlProviderTests.cs
+++ b/src/Umbraco.Tests/Routing/MediaUrlProviderTests.cs
@@ -45,7 +45,7 @@ namespace Umbraco.Tests.Routing
var umbracoContext = GetUmbracoContext("/", mediaUrlProviders: new[] { _mediaUrlProvider });
var publishedContent = CreatePublishedContent(Constants.PropertyEditors.Aliases.UploadField, expected, null);
- var resolvedUrl = umbracoContext.UrlProvider.GetMediaUrl(publishedContent, "umbracoFile", UrlMode.Auto, null, null);
+ var resolvedUrl = umbracoContext.UrlProvider.GetMediaUrl(publishedContent, UrlMode.Auto);
Assert.AreEqual(expected, resolvedUrl);
}
@@ -64,7 +64,7 @@ namespace Umbraco.Tests.Routing
var umbracoContext = GetUmbracoContext("/", mediaUrlProviders: new[] { _mediaUrlProvider });
var publishedContent = CreatePublishedContent(Constants.PropertyEditors.Aliases.ImageCropper, imageCropperValue, configuration);
- var resolvedUrl = umbracoContext.UrlProvider.GetMediaUrl(publishedContent, "umbracoFile", UrlMode.Auto, null, null);
+ var resolvedUrl = umbracoContext.UrlProvider.GetMediaUrl(publishedContent, UrlMode.Auto);
Assert.AreEqual(expected, resolvedUrl);
}
@@ -78,7 +78,7 @@ namespace Umbraco.Tests.Routing
var umbracoContext = GetUmbracoContext("http://localhost", mediaUrlProviders: new[] { _mediaUrlProvider });
var publishedContent = CreatePublishedContent(Constants.PropertyEditors.Aliases.UploadField, mediaUrl, null);
- var resolvedUrl = umbracoContext.UrlProvider.GetMediaUrl(publishedContent, "umbracoFile", UrlMode.Absolute, null, null);
+ var resolvedUrl = umbracoContext.UrlProvider.GetMediaUrl(publishedContent, UrlMode.Absolute);
Assert.AreEqual(expected, resolvedUrl);
}
@@ -89,7 +89,7 @@ namespace Umbraco.Tests.Routing
var umbracoContext = GetUmbracoContext("/", mediaUrlProviders: new[] { _mediaUrlProvider });
var publishedContent = CreatePublishedContent(Constants.PropertyEditors.Aliases.Boolean, "0", null);
- var resolvedUrl = umbracoContext.UrlProvider.GetMediaUrl(publishedContent, "test", UrlMode.Absolute, null, null);
+ var resolvedUrl = umbracoContext.UrlProvider.GetMediaUrl(publishedContent, UrlMode.Absolute, propertyAlias: "test");
Assert.AreEqual(string.Empty, resolvedUrl);
}
@@ -116,7 +116,7 @@ namespace Umbraco.Tests.Routing
var contentType = new PublishedContentType(666, "alias", PublishedItemType.Content, Enumerable.Empty(), new [] { umbracoFilePropertyType }, ContentVariation.Culture);
var publishedContent = new SolidPublishedContent(contentType) {Properties = new[] {property}};
- var resolvedUrl = umbracoContext.UrlProvider.GetMediaUrl(publishedContent, "umbracoFile", UrlMode.Auto, "da", null);
+ var resolvedUrl = umbracoContext.UrlProvider.GetMediaUrl(publishedContent, UrlMode.Auto, "da");
Assert.AreEqual(daMediaUrl, resolvedUrl);
}
diff --git a/src/Umbraco.Tests/Routing/UrlProviderTests.cs b/src/Umbraco.Tests/Routing/UrlProviderTests.cs
index 3f39e4d4e8..ca13e06f0a 100644
--- a/src/Umbraco.Tests/Routing/UrlProviderTests.cs
+++ b/src/Umbraco.Tests/Routing/UrlProviderTests.cs
@@ -185,7 +185,7 @@ namespace Umbraco.Tests.Routing
snapshotService: snapshotService.Object);
//even though we are asking for a specific culture URL, there are no domains assigned so all that can be returned is a normal relative url.
- var url = umbracoContext.UrlProvider.GetUrl(1234, "fr-FR");
+ var url = umbracoContext.UrlProvider.GetUrl(1234, culture: "fr-FR");
Assert.AreEqual("/home/test-fr/", url);
}
@@ -239,7 +239,7 @@ namespace Umbraco.Tests.Routing
snapshotService: snapshotService.Object);
- var url = umbracoContext.UrlProvider.GetUrl(1234, "fr-FR");
+ var url = umbracoContext.UrlProvider.GetUrl(1234, culture: "fr-FR");
Assert.AreEqual("/home/test-fr/", url);
}
@@ -293,7 +293,7 @@ namespace Umbraco.Tests.Routing
snapshotService: snapshotService.Object);
- var url = umbracoContext.UrlProvider.GetUrl(1234, "fr-FR");
+ var url = umbracoContext.UrlProvider.GetUrl(1234, culture: "fr-FR");
//the current uri is not the culture specific domain we want, so the result is an absolute path to the culture specific domain
Assert.AreEqual("http://example.fr/home/test-fr/", url);
diff --git a/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs b/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs
index 3709490697..397a22fc62 100644
--- a/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs
+++ b/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs
@@ -92,13 +92,12 @@ namespace Umbraco.Tests.Scoping
null,
publishedSnapshotAccessor,
Mock.Of(),
- Mock.Of(),
Logger,
ScopeProvider,
documentRepository, mediaRepository, memberRepository,
DefaultCultureAccessor,
new DatabaseDataSource(),
- Factory.GetInstance(), new SiteDomainHelper(),
+ Factory.GetInstance(),
Factory.GetInstance(),
Mock.Of(),
new UrlSegmentProviderCollection(new[] { new DefaultUrlSegmentProvider() }));
diff --git a/src/Umbraco.Tests/Services/ContentTypeServiceVariantsTests.cs b/src/Umbraco.Tests/Services/ContentTypeServiceVariantsTests.cs
index c70b96a175..3121988bfe 100644
--- a/src/Umbraco.Tests/Services/ContentTypeServiceVariantsTests.cs
+++ b/src/Umbraco.Tests/Services/ContentTypeServiceVariantsTests.cs
@@ -18,11 +18,9 @@ using Umbraco.Core.Services;
using Umbraco.Core.Strings;
using Umbraco.Core.Sync;
using Umbraco.Tests.Testing;
-using Umbraco.Web;
using Umbraco.Web.PublishedCache;
using Umbraco.Web.PublishedCache.NuCache;
using Umbraco.Web.PublishedCache.NuCache.DataSource;
-using Umbraco.Web.Routing;
namespace Umbraco.Tests.Services
{
@@ -65,13 +63,12 @@ namespace Umbraco.Tests.Services
null,
publishedSnapshotAccessor,
Mock.Of(),
- Mock.Of(),
Logger,
ScopeProvider,
documentRepository, mediaRepository, memberRepository,
DefaultCultureAccessor,
new DatabaseDataSource(),
- Factory.GetInstance(), new SiteDomainHelper(),
+ Factory.GetInstance(),
Factory.GetInstance(),
Mock.Of(),
new UrlSegmentProviderCollection(new[] { new DefaultUrlSegmentProvider() }));
diff --git a/src/Umbraco.Web/Models/Mapping/RedirectUrlMapDefinition.cs b/src/Umbraco.Web/Models/Mapping/RedirectUrlMapDefinition.cs
index 73123a0407..e773fcfee5 100644
--- a/src/Umbraco.Web/Models/Mapping/RedirectUrlMapDefinition.cs
+++ b/src/Umbraco.Web/Models/Mapping/RedirectUrlMapDefinition.cs
@@ -26,7 +26,7 @@ namespace Umbraco.Web.Models.Mapping
target.ContentId = source.ContentId;
target.CreateDateUtc = source.CreateDateUtc;
target.Culture = source.Culture;
- target.DestinationUrl = source.ContentId > 0 ? UmbracoContext?.UrlProvider?.GetUrl(source.ContentId, source.Culture) : "#";
+ target.DestinationUrl = source.ContentId > 0 ? UmbracoContext?.UrlProvider?.GetUrl(source.ContentId, culture: source.Culture) : "#";
target.OriginalUrl = UmbracoContext?.UrlProvider?.GetUrlFromRoute(source.ContentId, source.Url, source.Culture);
target.RedirectId = source.Key;
}
diff --git a/src/Umbraco.Web/Models/PublishedContentBase.cs b/src/Umbraco.Web/Models/PublishedContentBase.cs
index 25c84c97e5..935c594285 100644
--- a/src/Umbraco.Web/Models/PublishedContentBase.cs
+++ b/src/Umbraco.Web/Models/PublishedContentBase.cs
@@ -15,13 +15,6 @@ namespace Umbraco.Web.Models
[DebuggerDisplay("Content Id: {Id}}")]
public abstract class PublishedContentBase : IPublishedContent
{
- protected PublishedContentBase(IUmbracoContextAccessor umbracoContextAccessor)
- {
- UmbracoContextAccessor = umbracoContextAccessor ?? throw new ArgumentNullException(nameof(umbracoContextAccessor));
- }
-
- protected IUmbracoContextAccessor UmbracoContextAccessor { get; }
-
#region ContentType
public abstract IPublishedContentType ContentType { get; }
@@ -76,32 +69,6 @@ namespace Umbraco.Web.Models
///
public abstract DateTime UpdateDate { get; }
- ///
- ///
- /// The url of documents are computed by the document url providers. The url of medias are computed by the media url providers.
- ///
- public virtual string Url(string culture = null, UrlMode mode = UrlMode.Auto)
- {
- var umbracoContext = UmbracoContextAccessor.UmbracoContext;
-
- if (umbracoContext == null)
- throw new InvalidOperationException("Cannot compute Url for a content item when UmbracoContext is null.");
- if (umbracoContext.UrlProvider == null)
- throw new InvalidOperationException("Cannot compute Url for a content item when UmbracoContext.UrlProvider is null.");
-
- switch (ContentType.ItemType)
- {
- case PublishedItemType.Content:
- return umbracoContext.UrlProvider.GetUrl(this, mode, culture);
-
- case PublishedItemType.Media:
- return umbracoContext.UrlProvider.GetMediaUrl(this, mode, culture, Constants.Conventions.Media.File);
-
- default:
- throw new NotSupportedException();
- }
- }
-
///
public abstract DateTime CultureDate(string culture = null);
diff --git a/src/Umbraco.Web/PublishedCache/NuCache/ContentNode.cs b/src/Umbraco.Web/PublishedCache/NuCache/ContentNode.cs
index 7c9a739448..1e8d5ddfc9 100644
--- a/src/Umbraco.Web/PublishedCache/NuCache/ContentNode.cs
+++ b/src/Umbraco.Web/PublishedCache/NuCache/ContentNode.cs
@@ -1,5 +1,4 @@
using System;
-using System.Collections.Generic;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Web.PublishedCache.NuCache.DataSource;
@@ -40,11 +39,10 @@ namespace Umbraco.Web.PublishedCache.NuCache
DateTime createDate, int creatorId,
ContentData draftData, ContentData publishedData,
IPublishedSnapshotAccessor publishedSnapshotAccessor,
- IVariationContextAccessor variationContextAccessor,
- IUmbracoContextAccessor umbracoContextAccessor)
+ IVariationContextAccessor variationContextAccessor)
: this(id, uid, level, path, sortOrder, parentContentId, createDate, creatorId)
{
- SetContentTypeAndData(contentType, draftData, publishedData, publishedSnapshotAccessor, variationContextAccessor, umbracoContextAccessor);
+ SetContentTypeAndData(contentType, draftData, publishedData, publishedSnapshotAccessor, variationContextAccessor);
}
// 2-phases ctor, phase 1
@@ -66,7 +64,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
}
// two-phase ctor, phase 2
- public void SetContentTypeAndData(IPublishedContentType contentType, ContentData draftData, ContentData publishedData, IPublishedSnapshotAccessor publishedSnapshotAccessor, IVariationContextAccessor variationContextAccessor, IUmbracoContextAccessor umbracoContextAccessor)
+ public void SetContentTypeAndData(IPublishedContentType contentType, ContentData draftData, ContentData publishedData, IPublishedSnapshotAccessor publishedSnapshotAccessor, IVariationContextAccessor variationContextAccessor)
{
ContentType = contentType;
@@ -75,13 +73,13 @@ namespace Umbraco.Web.PublishedCache.NuCache
if (draftData != null)
{
- DraftContent = new PublishedContent(this, draftData, publishedSnapshotAccessor, variationContextAccessor, umbracoContextAccessor);
+ DraftContent = new PublishedContent(this, draftData, publishedSnapshotAccessor, variationContextAccessor);
DraftModel = DraftContent.CreateModel();
}
if (publishedData != null)
{
- PublishedContent = new PublishedContent(this, publishedData, publishedSnapshotAccessor, variationContextAccessor, umbracoContextAccessor);
+ PublishedContent = new PublishedContent(this, publishedData, publishedSnapshotAccessor, variationContextAccessor);
PublishedModel = PublishedContent.CreateModel();
}
}
diff --git a/src/Umbraco.Web/PublishedCache/NuCache/ContentNodeKit.cs b/src/Umbraco.Web/PublishedCache/NuCache/ContentNodeKit.cs
index 08557fe3db..5d757fff7b 100644
--- a/src/Umbraco.Web/PublishedCache/NuCache/ContentNodeKit.cs
+++ b/src/Umbraco.Web/PublishedCache/NuCache/ContentNodeKit.cs
@@ -21,8 +21,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
IPublishedContentType contentType,
IPublishedSnapshotAccessor publishedSnapshotAccessor,
IVariationContextAccessor variationContextAccessor,
- bool canBePublished,
- IUmbracoContextAccessor umbracoContextAccessor)
+ bool canBePublished)
{
var draftData = DraftData;
@@ -35,7 +34,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
if (draftData == null && !canBePublished)
draftData = PublishedData;
- Node.SetContentTypeAndData(contentType, draftData, publishedData, publishedSnapshotAccessor, variationContextAccessor,umbracoContextAccessor);
+ Node.SetContentTypeAndData(contentType, draftData, publishedData, publishedSnapshotAccessor, variationContextAccessor);
}
}
}
diff --git a/src/Umbraco.Web/PublishedCache/NuCache/ContentStore.cs b/src/Umbraco.Web/PublishedCache/NuCache/ContentStore.cs
index 9b1955fe43..298b98ca05 100644
--- a/src/Umbraco.Web/PublishedCache/NuCache/ContentStore.cs
+++ b/src/Umbraco.Web/PublishedCache/NuCache/ContentStore.cs
@@ -21,7 +21,6 @@ namespace Umbraco.Web.PublishedCache.NuCache
private readonly IPublishedSnapshotAccessor _publishedSnapshotAccessor;
private readonly IVariationContextAccessor _variationContextAccessor;
- private readonly IUmbracoContextAccessor _umbracoContextAccessor;
private readonly ConcurrentDictionary> _contentNodes;
private LinkedNode _root;
private readonly ConcurrentDictionary> _contentTypesById;
@@ -49,13 +48,11 @@ namespace Umbraco.Web.PublishedCache.NuCache
public ContentStore(
IPublishedSnapshotAccessor publishedSnapshotAccessor,
IVariationContextAccessor variationContextAccessor,
- IUmbracoContextAccessor umbracoContextAccessor,
ILogger logger,
BPlusTree localDb = null)
{
_publishedSnapshotAccessor = publishedSnapshotAccessor;
_variationContextAccessor = variationContextAccessor;
- _umbracoContextAccessor = umbracoContextAccessor;
_logger = logger;
_localDb = localDb;
@@ -449,7 +446,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
var canBePublished = ParentPublishedLocked(kit);
// and use
- kit.Build(link.Value, _publishedSnapshotAccessor, _variationContextAccessor, canBePublished, _umbracoContextAccessor);
+ kit.Build(link.Value, _publishedSnapshotAccessor, _variationContextAccessor, canBePublished);
return true;
}
diff --git a/src/Umbraco.Web/PublishedCache/NuCache/MemberCache.cs b/src/Umbraco.Web/PublishedCache/NuCache/MemberCache.cs
index 5164b2b3bf..2e196f629e 100644
--- a/src/Umbraco.Web/PublishedCache/NuCache/MemberCache.cs
+++ b/src/Umbraco.Web/PublishedCache/NuCache/MemberCache.cs
@@ -8,7 +8,6 @@ using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.Security;
using Umbraco.Core.Services;
-using Umbraco.Core.Services.Implement;
using Umbraco.Core.Xml.XPath;
using Umbraco.Web.PublishedCache.NuCache.Navigable;
@@ -19,7 +18,6 @@ namespace Umbraco.Web.PublishedCache.NuCache
private readonly IPublishedSnapshotAccessor _publishedSnapshotAccessor;
public readonly IVariationContextAccessor VariationContextAccessor;
- private readonly IUmbracoContextAccessor _umbracoContextAccessor;
private readonly IEntityXmlSerializer _entitySerializer;
private readonly IAppCache _snapshotCache;
private readonly IMemberService _memberService;
@@ -27,12 +25,11 @@ namespace Umbraco.Web.PublishedCache.NuCache
private readonly bool _previewDefault;
public MemberCache(bool previewDefault, IAppCache snapshotCache, IMemberService memberService, PublishedContentTypeCache contentTypeCache,
- IPublishedSnapshotAccessor publishedSnapshotAccessor, IVariationContextAccessor variationContextAccessor, IUmbracoContextAccessor umbracoContextAccessor, IEntityXmlSerializer entitySerializer)
+ IPublishedSnapshotAccessor publishedSnapshotAccessor, IVariationContextAccessor variationContextAccessor, IEntityXmlSerializer entitySerializer)
{
_snapshotCache = snapshotCache;
_publishedSnapshotAccessor = publishedSnapshotAccessor;
VariationContextAccessor = variationContextAccessor;
- _umbracoContextAccessor = umbracoContextAccessor;
_entitySerializer = entitySerializer;
_memberService = memberService;
_previewDefault = previewDefault;
@@ -68,14 +65,14 @@ namespace Umbraco.Web.PublishedCache.NuCache
var member = _memberService.GetById(memberId);
return member == null
? null
- : PublishedMember.Create(member, GetContentType(member.ContentTypeId), _previewDefault, _publishedSnapshotAccessor, VariationContextAccessor, _umbracoContextAccessor);
+ : PublishedMember.Create(member, GetContentType(member.ContentTypeId), _previewDefault, _publishedSnapshotAccessor, VariationContextAccessor);
});
}
private IPublishedContent /*IPublishedMember*/ GetById(IMember member, bool previewing)
{
return GetCacheItem(CacheKeys.MemberCacheMember("ById", _previewDefault, member.Id), () =>
- PublishedMember.Create(member, GetContentType(member.ContentTypeId), previewing, _publishedSnapshotAccessor, VariationContextAccessor, _umbracoContextAccessor));
+ PublishedMember.Create(member, GetContentType(member.ContentTypeId), previewing, _publishedSnapshotAccessor, VariationContextAccessor));
}
public IPublishedContent /*IPublishedMember*/ GetByProviderKey(object key)
@@ -110,7 +107,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
public IPublishedContent /*IPublishedMember*/ GetByMember(IMember member)
{
- return PublishedMember.Create(member, GetContentType(member.ContentTypeId), _previewDefault, _publishedSnapshotAccessor, VariationContextAccessor, _umbracoContextAccessor);
+ return PublishedMember.Create(member, GetContentType(member.ContentTypeId), _previewDefault, _publishedSnapshotAccessor, VariationContextAccessor);
}
public IEnumerable GetAtRoot(bool preview)
@@ -118,7 +115,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
// because members are flat (not a tree) everything is at root
// because we're loading everything... let's just not cache?
var members = _memberService.GetAllMembers();
- return members.Select(m => PublishedMember.Create(m, GetContentType(m.ContentTypeId), preview, _publishedSnapshotAccessor, VariationContextAccessor, _umbracoContextAccessor));
+ return members.Select(m => PublishedMember.Create(m, GetContentType(m.ContentTypeId), preview, _publishedSnapshotAccessor, VariationContextAccessor));
}
public XPathNavigator CreateNavigator()
diff --git a/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs b/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs
index 0a55049f9f..c227c75952 100644
--- a/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs
+++ b/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs
@@ -22,9 +22,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
ContentNode contentNode,
ContentData contentData,
IPublishedSnapshotAccessor publishedSnapshotAccessor,
- IVariationContextAccessor variationContextAccessor,
- IUmbracoContextAccessor umbracoContextAccessor)
- : base(umbracoContextAccessor)
+ IVariationContextAccessor variationContextAccessor)
{
_contentNode = contentNode ?? throw new ArgumentNullException(nameof(contentNode));
ContentData = contentData ?? throw new ArgumentNullException(nameof(contentData));
@@ -69,7 +67,6 @@ namespace Umbraco.Web.PublishedCache.NuCache
// used when cloning in ContentNode
public PublishedContent(ContentNode contentNode, PublishedContent origin)
- : base(origin.UmbracoContextAccessor)
{
_contentNode = contentNode;
_publishedSnapshotAccessor = origin._publishedSnapshotAccessor;
@@ -86,10 +83,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
}
// clone for previewing as draft a published content that is published and has no draft
- private PublishedContent(
- PublishedContent origin,
- IUmbracoContextAccessor umbracoContextAccessor)
- : base(umbracoContextAccessor)
+ private PublishedContent(PublishedContent origin)
{
_publishedSnapshotAccessor = origin._publishedSnapshotAccessor;
VariationContextAccessor = origin.VariationContextAccessor;
@@ -406,8 +400,8 @@ namespace Umbraco.Web.PublishedCache.NuCache
return this;
var cache = GetAppropriateCache();
- if (cache == null) return new PublishedContent(this, UmbracoContextAccessor).CreateModel();
- return (IPublishedContent)cache.Get(AsPreviewingCacheKey, () => new PublishedContent(this, UmbracoContextAccessor).CreateModel());
+ if (cache == null) return new PublishedContent(this).CreateModel();
+ return (IPublishedContent)cache.Get(AsPreviewingCacheKey, () => new PublishedContent(this).CreateModel());
}
// used by Navigable.Source,...
diff --git a/src/Umbraco.Web/PublishedCache/NuCache/PublishedMember.cs b/src/Umbraco.Web/PublishedCache/NuCache/PublishedMember.cs
index 4bfcbb2a3d..dc608fe391 100644
--- a/src/Umbraco.Web/PublishedCache/NuCache/PublishedMember.cs
+++ b/src/Umbraco.Web/PublishedCache/NuCache/PublishedMember.cs
@@ -20,10 +20,8 @@ namespace Umbraco.Web.PublishedCache.NuCache
ContentNode contentNode,
ContentData contentData,
IPublishedSnapshotAccessor publishedSnapshotAccessor,
- IVariationContextAccessor variationContextAccessor,
- IUmbracoContextAccessor umbracoContextAccessor
- )
- : base(contentNode, contentData, publishedSnapshotAccessor, variationContextAccessor, umbracoContextAccessor)
+ IVariationContextAccessor variationContextAccessor)
+ : base(contentNode, contentData, publishedSnapshotAccessor, variationContextAccessor)
{
_member = member;
}
@@ -33,8 +31,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
IPublishedContentType contentType,
bool previewing,
IPublishedSnapshotAccessor publishedSnapshotAccessor,
- IVariationContextAccessor variationContextAccessor,
- IUmbracoContextAccessor umbracoContextAccessor)
+ IVariationContextAccessor variationContextAccessor)
{
var d = new ContentData
{
@@ -50,7 +47,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
member.Level, member.Path, member.SortOrder,
member.ParentId,
member.CreateDate, member.CreatorId);
- return new PublishedMember(member, n, d, publishedSnapshotAccessor, variationContextAccessor, umbracoContextAccessor).CreateModel();
+ return new PublishedMember(member, n, d, publishedSnapshotAccessor, variationContextAccessor).CreateModel();
}
private static Dictionary GetPropertyValues(IPublishedContentType contentType, IMember member)
diff --git a/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs b/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs
index f847a9f2ce..5a3672ed57 100755
--- a/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs
+++ b/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs
@@ -34,7 +34,6 @@ namespace Umbraco.Web.PublishedCache.NuCache
{
private readonly ServiceContext _serviceContext;
private readonly IPublishedContentTypeFactory _publishedContentTypeFactory;
- private readonly IUmbracoContextAccessor _umbracoContextAccessor;
private readonly IScopeProvider _scopeProvider;
private readonly IDataSource _dataSource;
private readonly ILogger _logger;
@@ -42,7 +41,6 @@ namespace Umbraco.Web.PublishedCache.NuCache
private readonly IMediaRepository _mediaRepository;
private readonly IMemberRepository _memberRepository;
private readonly IGlobalSettings _globalSettings;
- private readonly ISiteDomainHelper _siteDomainHelper;
private readonly IEntityXmlSerializer _entitySerializer;
private readonly IDefaultCultureAccessor _defaultCultureAccessor;
private readonly UrlSegmentProviderCollection _urlSegmentProviders;
@@ -83,11 +81,10 @@ namespace Umbraco.Web.PublishedCache.NuCache
public PublishedSnapshotService(Options options, IMainDom mainDom, IRuntimeState runtime,
ServiceContext serviceContext, IPublishedContentTypeFactory publishedContentTypeFactory, IdkMap idkMap,
- IPublishedSnapshotAccessor publishedSnapshotAccessor, IVariationContextAccessor variationContextAccessor,
- IUmbracoContextAccessor umbracoContextAccessor, ILogger logger, IScopeProvider scopeProvider,
+ IPublishedSnapshotAccessor publishedSnapshotAccessor, IVariationContextAccessor variationContextAccessor, ILogger logger, IScopeProvider scopeProvider,
IDocumentRepository documentRepository, IMediaRepository mediaRepository, IMemberRepository memberRepository,
IDefaultCultureAccessor defaultCultureAccessor,
- IDataSource dataSource, IGlobalSettings globalSettings, ISiteDomainHelper siteDomainHelper,
+ IDataSource dataSource, IGlobalSettings globalSettings,
IEntityXmlSerializer entitySerializer, IPublishedModelFactory publishedModelFactory,
UrlSegmentProviderCollection urlSegmentProviders)
: base(publishedSnapshotAccessor, variationContextAccessor)
@@ -97,7 +94,6 @@ namespace Umbraco.Web.PublishedCache.NuCache
_serviceContext = serviceContext;
_publishedContentTypeFactory = publishedContentTypeFactory;
- _umbracoContextAccessor = umbracoContextAccessor;
_dataSource = dataSource;
_logger = logger;
_scopeProvider = scopeProvider;
@@ -106,7 +102,6 @@ namespace Umbraco.Web.PublishedCache.NuCache
_memberRepository = memberRepository;
_defaultCultureAccessor = defaultCultureAccessor;
_globalSettings = globalSettings;
- _siteDomainHelper = siteDomainHelper;
_urlSegmentProviders = urlSegmentProviders;
// we need an Xml serializer here so that the member cache can support XPath,
@@ -156,13 +151,13 @@ namespace Umbraco.Web.PublishedCache.NuCache
// stores are created with a db so they can write to it, but they do not read from it,
// stores need to be populated, happens in OnResolutionFrozen which uses _localDbExists to
// figure out whether it can read the databases or it should populate them from sql
- _contentStore = new ContentStore(publishedSnapshotAccessor, variationContextAccessor, _umbracoContextAccessor, logger, _localContentDb);
- _mediaStore = new ContentStore(publishedSnapshotAccessor, variationContextAccessor, _umbracoContextAccessor, logger, _localMediaDb);
+ _contentStore = new ContentStore(publishedSnapshotAccessor, variationContextAccessor, logger, _localContentDb);
+ _mediaStore = new ContentStore(publishedSnapshotAccessor, variationContextAccessor, logger, _localMediaDb);
}
else
{
- _contentStore = new ContentStore(publishedSnapshotAccessor, variationContextAccessor, _umbracoContextAccessor, logger);
- _mediaStore = new ContentStore(publishedSnapshotAccessor, variationContextAccessor, _umbracoContextAccessor, logger);
+ _contentStore = new ContentStore(publishedSnapshotAccessor, variationContextAccessor, logger);
+ _mediaStore = new ContentStore(publishedSnapshotAccessor, variationContextAccessor, logger);
}
_domainStore = new SnapDictionary();
@@ -1077,7 +1072,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
{
ContentCache = new ContentCache(previewDefault, contentSnap, snapshotCache, elementsCache, domainCache, _globalSettings),
MediaCache = new MediaCache(previewDefault, mediaSnap, snapshotCache, elementsCache),
- MemberCache = new MemberCache(previewDefault, snapshotCache, _serviceContext.MemberService, memberTypeCache, PublishedSnapshotAccessor, VariationContextAccessor, _umbracoContextAccessor, _entitySerializer),
+ MemberCache = new MemberCache(previewDefault, snapshotCache, _serviceContext.MemberService, memberTypeCache, PublishedSnapshotAccessor, VariationContextAccessor, _entitySerializer),
DomainCache = domainCache,
SnapshotCache = snapshotCache,
ElementsCache = elementsCache
diff --git a/src/Umbraco.Web/PublishedCache/PublishedMember.cs b/src/Umbraco.Web/PublishedCache/PublishedMember.cs
index 08e00c1f17..9c6f60da97 100644
--- a/src/Umbraco.Web/PublishedCache/PublishedMember.cs
+++ b/src/Umbraco.Web/PublishedCache/PublishedMember.cs
@@ -21,9 +21,7 @@ namespace Umbraco.Web.PublishedCache
public PublishedMember(
IMember member,
- IPublishedContentType publishedMemberType,
- IUmbracoContextAccessor umbracoContextAccessor)
- :base(umbracoContextAccessor)
+ IPublishedContentType publishedMemberType)
{
_member = member ?? throw new ArgumentNullException(nameof(member));
_membershipUser = member;
diff --git a/src/Umbraco.Web/PublishedContentExtensions.cs b/src/Umbraco.Web/PublishedContentExtensions.cs
index b31527eb57..eb38826193 100644
--- a/src/Umbraco.Web/PublishedContentExtensions.cs
+++ b/src/Umbraco.Web/PublishedContentExtensions.cs
@@ -1208,5 +1208,43 @@ namespace Umbraco.Web
}
#endregion
+
+ #region Url
+
+ ///
+ /// Gets the url of the content item.
+ ///
+ ///
+ /// If the content item is a document, then this method returns the url of the
+ /// document. If it is a media, then this methods return the media url for the
+ /// 'umbracoFile' property. Use the MediaUrl() method to get the media url for other
+ /// properties.
+ /// The value of this property is contextual. It depends on the 'current' request uri,
+ /// if any. In addition, when the content type is multi-lingual, this is the url for the
+ /// specified culture. Otherwise, it is the invariant url.
+ ///
+ public static string Url(this IPublishedContent content, string culture = null, UrlMode mode = UrlMode.Auto)
+ {
+ var umbracoContext = Composing.Current.UmbracoContext;
+
+ if (umbracoContext == null)
+ throw new InvalidOperationException("Cannot resolve a Url when Current.UmbracoContext is null.");
+ if (umbracoContext.UrlProvider == null)
+ throw new InvalidOperationException("Cannot resolve a Url when Current.UmbracoContext.UrlProvider is null.");
+
+ switch (content.ContentType.ItemType)
+ {
+ case PublishedItemType.Content:
+ return umbracoContext.UrlProvider.GetUrl(content, mode, culture);
+
+ case PublishedItemType.Media:
+ return umbracoContext.UrlProvider.GetMediaUrl(content, mode, culture, Constants.Conventions.Media.File);
+
+ default:
+ throw new NotSupportedException();
+ }
+ }
+
+ #endregion
}
}
diff --git a/src/Umbraco.Web/PublishedElementExtensions.cs b/src/Umbraco.Web/PublishedElementExtensions.cs
index 2de8259d3c..c35c85c606 100644
--- a/src/Umbraco.Web/PublishedElementExtensions.cs
+++ b/src/Umbraco.Web/PublishedElementExtensions.cs
@@ -209,9 +209,9 @@ namespace Umbraco.Web
var umbracoContext = Composing.Current.UmbracoContext;
if (umbracoContext == null)
- throw new InvalidOperationException("Cannot resolve a Url for a content item when Current.UmbracoContext is null.");
+ throw new InvalidOperationException("Cannot resolve a Url when Current.UmbracoContext is null.");
if (umbracoContext.UrlProvider == null)
- throw new InvalidOperationException("Cannot resolve a Url for a content item when Current.UmbracoContext.UrlProvider is null.");
+ throw new InvalidOperationException("Cannot resolve a Url when Current.UmbracoContext.UrlProvider is null.");
return umbracoContext.UrlProvider.GetMediaUrl(content, mode, culture, propertyAlias);
}
diff --git a/src/Umbraco.Web/Routing/UrlProviderExtensions.cs b/src/Umbraco.Web/Routing/UrlProviderExtensions.cs
index 4b66d56830..27a27399bf 100644
--- a/src/Umbraco.Web/Routing/UrlProviderExtensions.cs
+++ b/src/Umbraco.Web/Routing/UrlProviderExtensions.cs
@@ -109,7 +109,7 @@ namespace Umbraco.Web.Routing
string url;
try
{
- url = umbracoContext.UrlProvider.GetUrl(content.Id, culture);
+ url = umbracoContext.UrlProvider.GetUrl(content.Id, culture: culture);
}
catch (Exception ex)
{