From ff7c74ec8aaa4ce33dc5b0eb482f9baac302c086 Mon Sep 17 00:00:00 2001 From: Stephan Date: Mon, 30 Apr 2018 21:29:49 +0200 Subject: [PATCH] Rename accessors --- .../ICurrentVariationAccessor.cs | 13 --------- .../IVariationContextAccessor.cs | 13 +++++++++ ... ThreadCultureVariationContextAccessor.cs} | 10 +++---- ...> ThreadStaticVariationContextAccessor.cs} | 8 +++--- ...urrentVariation.cs => VariationContext.cs} | 8 +++--- src/Umbraco.Core/Umbraco.Core.csproj | 8 +++--- .../PublishedContentCacheTests.cs | 4 +-- .../PublishedContent/NuCacheTests.cs | 10 +++---- .../PublishedContentMoreTests.cs | 2 +- .../Scoping/ScopedNuCacheTests.cs | 6 ++-- .../Security/BackOfficeCookieManagerTests.cs | 4 +-- .../TestControllerActivatorBase.cs | 2 +- .../TestHelpers/Stubs/TestPublishedContent.cs | 4 +-- .../TestHelpers/TestObjects-Mocks.cs | 2 +- .../TestHelpers/TestWithDatabaseBase.cs | 12 ++++---- ...essor.cs => TestDefaultCultureAccessor.cs} | 2 +- ...sor.cs => TestVariationContextAccessor.cs} | 6 ++-- .../Testing/TestingTests/MockTests.cs | 2 +- src/Umbraco.Tests/Umbraco.Tests.csproj | 4 +-- ...RenderIndexActionSelectorAttributeTests.cs | 8 +++--- .../Web/Mvc/SurfaceControllerTests.cs | 10 +++---- .../Web/Mvc/UmbracoViewPageTests.cs | 4 +-- .../Web/TemplateUtilitiesTests.cs | 2 +- .../Web/WebExtensionMethodTests.cs | 6 ++-- .../Cache/CacheRefresherComponent.cs | 2 +- src/Umbraco.Web/Editors/MacroController.cs | 8 +++--- ...eAccessor.cs => DefaultCultureAccessor.cs} | 8 +++--- ...Accessor.cs => IDefaultCultureAccessor.cs} | 4 +-- .../PublishedCache/NuCache/ContentNode.cs | 16 +++++------ .../PublishedCache/NuCache/ContentNodeKit.cs | 4 +-- .../PublishedCache/NuCache/ContentStore.cs | 12 ++++---- .../PublishedCache/NuCache/MemberCache.cs | 14 +++++----- .../PublishedCache/NuCache/Property.cs | 2 +- .../NuCache/PublishedContent.cs | 16 +++++------ .../PublishedCache/NuCache/PublishedMember.cs | 8 +++--- .../NuCache/PublishedSnapshotService.cs | 22 +++++++-------- .../PublishedSnapshotServiceBase.cs | 6 ++-- .../XmlPublishedCache/DomainCache.cs | 4 +-- .../PublishedSnapshotService.cs | 28 +++++++++---------- .../XmlPublishedCache/XmlCacheComponent.cs | 4 +-- src/Umbraco.Web/Routing/UrlProvider.cs | 16 +++++------ .../Runtime/WebRuntimeComponent.cs | 8 +++--- src/Umbraco.Web/Umbraco.Web.csproj | 4 +-- src/Umbraco.Web/UmbracoContext.cs | 12 ++++---- src/Umbraco.Web/UmbracoModule.cs | 4 +-- src/Umbraco.Web/umbraco.presentation/page.cs | 12 ++++---- 46 files changed, 182 insertions(+), 182 deletions(-) delete mode 100644 src/Umbraco.Core/Models/PublishedContent/ICurrentVariationAccessor.cs create mode 100644 src/Umbraco.Core/Models/PublishedContent/IVariationContextAccessor.cs rename src/Umbraco.Core/Models/PublishedContent/{ThreadCultureCurrentVariationAccessor.cs => ThreadCultureVariationContextAccessor.cs} (58%) rename src/Umbraco.Core/Models/PublishedContent/{ThreadStaticCurrentVariationAccessor.cs => ThreadStaticVariationContextAccessor.cs} (66%) rename src/Umbraco.Core/Models/PublishedContent/{CurrentVariation.cs => VariationContext.cs} (71%) rename src/Umbraco.Tests/Testing/Objects/Accessors/{TestSystemDefaultCultureAccessor.cs => TestDefaultCultureAccessor.cs} (79%) rename src/Umbraco.Tests/Testing/Objects/Accessors/{TestCurrentVariationAccessor.cs => TestVariationContextAccessor.cs} (52%) rename src/Umbraco.Web/PublishedCache/{SystemDefaultCultureAccessor.cs => DefaultCultureAccessor.cs} (58%) rename src/Umbraco.Web/PublishedCache/{ISystemDefaultCultureAccessor.cs => IDefaultCultureAccessor.cs} (80%) diff --git a/src/Umbraco.Core/Models/PublishedContent/ICurrentVariationAccessor.cs b/src/Umbraco.Core/Models/PublishedContent/ICurrentVariationAccessor.cs deleted file mode 100644 index 969601f080..0000000000 --- a/src/Umbraco.Core/Models/PublishedContent/ICurrentVariationAccessor.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace Umbraco.Core.Models.PublishedContent -{ - /// - /// Gives access to the current . - /// - public interface ICurrentVariationAccessor - { - /// - /// Gets or sets the current . - /// - CurrentVariation CurrentVariation { get; set; } - } -} diff --git a/src/Umbraco.Core/Models/PublishedContent/IVariationContextAccessor.cs b/src/Umbraco.Core/Models/PublishedContent/IVariationContextAccessor.cs new file mode 100644 index 0000000000..b9c416da00 --- /dev/null +++ b/src/Umbraco.Core/Models/PublishedContent/IVariationContextAccessor.cs @@ -0,0 +1,13 @@ +namespace Umbraco.Core.Models.PublishedContent +{ + /// + /// Gives access to the current . + /// + public interface IVariationContextAccessor + { + /// + /// Gets or sets the current . + /// + VariationContext VariationContext { get; set; } + } +} diff --git a/src/Umbraco.Core/Models/PublishedContent/ThreadCultureCurrentVariationAccessor.cs b/src/Umbraco.Core/Models/PublishedContent/ThreadCultureVariationContextAccessor.cs similarity index 58% rename from src/Umbraco.Core/Models/PublishedContent/ThreadCultureCurrentVariationAccessor.cs rename to src/Umbraco.Core/Models/PublishedContent/ThreadCultureVariationContextAccessor.cs index f0c9e87a29..7a000c223a 100644 --- a/src/Umbraco.Core/Models/PublishedContent/ThreadCultureCurrentVariationAccessor.cs +++ b/src/Umbraco.Core/Models/PublishedContent/ThreadCultureVariationContextAccessor.cs @@ -5,18 +5,18 @@ using System.Threading; namespace Umbraco.Core.Models.PublishedContent { /// - /// Provides a CurrentUICulture-based implementation of . + /// Provides a CurrentUICulture-based implementation of . /// /// /// This accessor does not support segments. There is no need to set the current context. /// - public class ThreadCultureCurrentVariationAccessor : ICurrentVariationAccessor + public class ThreadCultureVariationContextAccessor : IVariationContextAccessor { - private readonly ConcurrentDictionary _contexts = new ConcurrentDictionary(); + private readonly ConcurrentDictionary _contexts = new ConcurrentDictionary(); - public CurrentVariation CurrentVariation + public VariationContext VariationContext { - get => _contexts.GetOrAdd(Thread.CurrentThread.CurrentUICulture.Name, culture => new CurrentVariation(culture)); + get => _contexts.GetOrAdd(Thread.CurrentThread.CurrentUICulture.Name, culture => new VariationContext(culture)); set => throw new NotSupportedException(); } } diff --git a/src/Umbraco.Core/Models/PublishedContent/ThreadStaticCurrentVariationAccessor.cs b/src/Umbraco.Core/Models/PublishedContent/ThreadStaticVariationContextAccessor.cs similarity index 66% rename from src/Umbraco.Core/Models/PublishedContent/ThreadStaticCurrentVariationAccessor.cs rename to src/Umbraco.Core/Models/PublishedContent/ThreadStaticVariationContextAccessor.cs index 19ec89ff97..f77bb3514c 100644 --- a/src/Umbraco.Core/Models/PublishedContent/ThreadStaticCurrentVariationAccessor.cs +++ b/src/Umbraco.Core/Models/PublishedContent/ThreadStaticVariationContextAccessor.cs @@ -3,18 +3,18 @@ namespace Umbraco.Core.Models.PublishedContent { /// - /// Provides a ThreadStatic-based implementation of . + /// Provides a ThreadStatic-based implementation of . /// /// /// Something must set the current context. /// - public class ThreadStaticCurrentVariationAccessor : ICurrentVariationAccessor + public class ThreadStaticVariationContextAccessor : IVariationContextAccessor { [ThreadStatic] - private static CurrentVariation _context; + private static VariationContext _context; /// - public CurrentVariation CurrentVariation + public VariationContext VariationContext { get => _context; set => _context = value; diff --git a/src/Umbraco.Core/Models/PublishedContent/CurrentVariation.cs b/src/Umbraco.Core/Models/PublishedContent/VariationContext.cs similarity index 71% rename from src/Umbraco.Core/Models/PublishedContent/CurrentVariation.cs rename to src/Umbraco.Core/Models/PublishedContent/VariationContext.cs index 74a8c403c3..b83002fdce 100644 --- a/src/Umbraco.Core/Models/PublishedContent/CurrentVariation.cs +++ b/src/Umbraco.Core/Models/PublishedContent/VariationContext.cs @@ -1,14 +1,14 @@ namespace Umbraco.Core.Models.PublishedContent { /// - /// Represents the current variation. + /// Represents the variation context. /// - public class CurrentVariation + public class VariationContext { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - public CurrentVariation(string culture = null, string segment = null) + public VariationContext(string culture = null, string segment = null) { Culture = culture ?? ""; // cannot be null, default to invariant Segment = segment ?? ""; // cannot be null, default to neutral diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 9284a12cbd..2d4b59cf3f 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -369,11 +369,11 @@ - + - - - + + + diff --git a/src/Umbraco.Tests/Cache/PublishedCache/PublishedContentCacheTests.cs b/src/Umbraco.Tests/Cache/PublishedCache/PublishedContentCacheTests.cs index 516fdbdd0e..bf70922768 100644 --- a/src/Umbraco.Tests/Cache/PublishedCache/PublishedContentCacheTests.cs +++ b/src/Umbraco.Tests/Cache/PublishedCache/PublishedContentCacheTests.cs @@ -63,7 +63,7 @@ namespace Umbraco.Tests.Cache.PublishedCache _xml.LoadXml(GetXml()); var xmlStore = new XmlStore(() => _xml, null, null, null); var cacheProvider = new StaticCacheProvider(); - var domainCache = new DomainCache(ServiceContext.DomainService, SystemDefaultCultureAccessor); + var domainCache = new DomainCache(ServiceContext.DomainService, DefaultCultureAccessor); var publishedShapshot = new Umbraco.Web.PublishedCache.XmlPublishedCache.PublishedSnapshot( new PublishedContentCache(xmlStore, domainCache, cacheProvider, globalSettings, new SiteDomainHelper(), ContentTypesCache, null, null), new PublishedMediaCache(xmlStore, ServiceContext.MediaService, ServiceContext.UserService, cacheProvider, ContentTypesCache), @@ -79,7 +79,7 @@ namespace Umbraco.Tests.Cache.PublishedCache umbracoSettings, Enumerable.Empty(), globalSettings, - new TestCurrentVariationAccessor()); + new TestVariationContextAccessor()); _cache = _umbracoContext.ContentCache; } diff --git a/src/Umbraco.Tests/PublishedContent/NuCacheTests.cs b/src/Umbraco.Tests/PublishedContent/NuCacheTests.cs index fbe6708008..1ae6a9f6fb 100644 --- a/src/Umbraco.Tests/PublishedContent/NuCacheTests.cs +++ b/src/Umbraco.Tests/PublishedContent/NuCacheTests.cs @@ -128,7 +128,7 @@ namespace Umbraco.Tests.PublishedContent dataTypeService); // create a variation accessor - var variationAccessor = new TestCurrentVariationAccessor(); + var variationAccessor = new TestVariationContextAccessor(); // at last, create the complete NuCache snapshot service! var options = new PublishedSnapshotService.Options { IgnoreLocalDb = true }; @@ -145,7 +145,7 @@ namespace Umbraco.Tests.PublishedContent Mock.Of(), Mock.Of(), Mock.Of(), - new TestSystemDefaultCultureAccessor(), + new TestDefaultCultureAccessor(), dataSource, globalSettings, new SiteDomainHelper()); @@ -155,7 +155,7 @@ namespace Umbraco.Tests.PublishedContent var publishedContent = snapshot.Content.GetById(1); // invariant is the current default - variationAccessor.CurrentVariation = new CurrentVariation(); + variationAccessor.VariationContext = new VariationContext(); Assert.IsNotNull(publishedContent); Assert.AreEqual("It Works1!", publishedContent.Name); @@ -176,14 +176,14 @@ namespace Umbraco.Tests.PublishedContent Assert.AreEqual("name-uk2", draftContent.GetCulture("en-UK").Name); // now french is default - variationAccessor.CurrentVariation = new CurrentVariation("fr-FR"); + variationAccessor.VariationContext = new VariationContext("fr-FR"); Assert.AreEqual("val-fr1", publishedContent.Value("prop")); Assert.AreEqual("name-fr1", publishedContent.GetCulture().Name); Assert.AreEqual("name-fr1", publishedContent.Name); Assert.AreEqual(new DateTime(2018, 01, 01, 01, 00, 00), publishedContent.GetCulture().Date); // now uk is default - variationAccessor.CurrentVariation = new CurrentVariation("en-UK"); + variationAccessor.VariationContext = new VariationContext("en-UK"); Assert.AreEqual("val-uk1", publishedContent.Value("prop")); Assert.AreEqual("name-uk1", publishedContent.GetCulture().Name); Assert.AreEqual("name-uk1", publishedContent.Name); diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentMoreTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentMoreTests.cs index 8a465a1da8..d0ac8b0216 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentMoreTests.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentMoreTests.cs @@ -76,7 +76,7 @@ namespace Umbraco.Tests.PublishedContent TestObjects.GetUmbracoSettings(), Enumerable.Empty(), globalSettings, - new TestCurrentVariationAccessor()); + new TestVariationContextAccessor()); return umbracoContext; } diff --git a/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs b/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs index c1be083c38..d59fe0bb51 100644 --- a/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs +++ b/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs @@ -90,11 +90,11 @@ namespace Umbraco.Tests.Scoping contentTypeFactory, null, publishedSnapshotAccessor, - Mock.Of(), + Mock.Of(), Logger, ScopeProvider, documentRepository, mediaRepository, memberRepository, - SystemDefaultCultureAccessor, + DefaultCultureAccessor, new DatabaseDataSource(), Container.GetInstance(), new SiteDomainHelper()); } @@ -114,7 +114,7 @@ namespace Umbraco.Tests.Scoping umbracoSettings ?? SettingsForTests.GetDefaultUmbracoSettings(), urlProviders ?? Enumerable.Empty(), globalSettings, - new TestCurrentVariationAccessor()); + new TestVariationContextAccessor()); if (setSingleton) Umbraco.Web.Composing.Current.UmbracoContextAccessor.UmbracoContext = umbracoContext; diff --git a/src/Umbraco.Tests/Security/BackOfficeCookieManagerTests.cs b/src/Umbraco.Tests/Security/BackOfficeCookieManagerTests.cs index 49b4f3f5aa..11ef8a9411 100644 --- a/src/Umbraco.Tests/Security/BackOfficeCookieManagerTests.cs +++ b/src/Umbraco.Tests/Security/BackOfficeCookieManagerTests.cs @@ -34,7 +34,7 @@ namespace Umbraco.Tests.Security Mock.Of(), new WebSecurity(Mock.Of(), Current.Services.UserService, globalSettings), TestObjects.GetUmbracoSettings(), new List(),globalSettings, - new TestCurrentVariationAccessor()); + new TestVariationContextAccessor()); var runtime = Mock.Of(x => x.Level == RuntimeLevel.Install); var mgr = new BackOfficeCookieManager( @@ -54,7 +54,7 @@ namespace Umbraco.Tests.Security Mock.Of(), new WebSecurity(Mock.Of(), Current.Services.UserService, globalSettings), TestObjects.GetUmbracoSettings(), new List(), globalSettings, - new TestCurrentVariationAccessor()); + new TestVariationContextAccessor()); var runtime = Mock.Of(x => x.Level == RuntimeLevel.Run); var mgr = new BackOfficeCookieManager(Mock.Of(accessor => accessor.UmbracoContext == umbCtx), runtime, TestObjects.GetGlobalSettings()); diff --git a/src/Umbraco.Tests/TestHelpers/ControllerTesting/TestControllerActivatorBase.cs b/src/Umbraco.Tests/TestHelpers/ControllerTesting/TestControllerActivatorBase.cs index 6053a1fad3..ded14c40ab 100644 --- a/src/Umbraco.Tests/TestHelpers/ControllerTesting/TestControllerActivatorBase.cs +++ b/src/Umbraco.Tests/TestHelpers/ControllerTesting/TestControllerActivatorBase.cs @@ -150,7 +150,7 @@ namespace Umbraco.Tests.TestHelpers.ControllerTesting Mock.Of(section => section.WebRouting == Mock.Of(routingSection => routingSection.UrlProviderMode == UrlProviderMode.Auto.ToString())), Enumerable.Empty(), globalSettings, - new TestCurrentVariationAccessor(), + new TestVariationContextAccessor(), true); //replace it var urlHelper = new Mock(); diff --git a/src/Umbraco.Tests/TestHelpers/Stubs/TestPublishedContent.cs b/src/Umbraco.Tests/TestHelpers/Stubs/TestPublishedContent.cs index 19cb5473e3..46ff57c1f3 100644 --- a/src/Umbraco.Tests/TestHelpers/Stubs/TestPublishedContent.cs +++ b/src/Umbraco.Tests/TestHelpers/Stubs/TestPublishedContent.cs @@ -18,12 +18,12 @@ namespace Umbraco.Tests.TestHelpers.Stubs public int TemplateId { get; set; } public int SortOrder { get; set; } public string Name { get; set; } - public ICurrentVariationAccessor VariationAccessor { get; set; } + public IVariationContextAccessor VariationContextAccessor { get; set; } public PublishedCultureInfos GetCulture(string culture = null) { // handle context culture if (culture == null) - culture = VariationAccessor?.CurrentVariation.Culture; + culture = VariationContextAccessor?.VariationContext.Culture; // no invariant culture infos if (culture == "" || Cultures == null) return null; diff --git a/src/Umbraco.Tests/TestHelpers/TestObjects-Mocks.cs b/src/Umbraco.Tests/TestHelpers/TestObjects-Mocks.cs index 4b7fddb337..5745e501ab 100644 --- a/src/Umbraco.Tests/TestHelpers/TestObjects-Mocks.cs +++ b/src/Umbraco.Tests/TestHelpers/TestObjects-Mocks.cs @@ -120,7 +120,7 @@ namespace Umbraco.Tests.TestHelpers var urlProviders = Enumerable.Empty(); if (accessor == null) accessor = new TestUmbracoContextAccessor(); - return UmbracoContext.EnsureContext(accessor, httpContext, publishedSnapshotService, webSecurity, umbracoSettings, urlProviders, globalSettings, new TestCurrentVariationAccessor(), true); + return UmbracoContext.EnsureContext(accessor, httpContext, publishedSnapshotService, webSecurity, umbracoSettings, urlProviders, globalSettings, new TestVariationContextAccessor(), true); } public IUmbracoSettingsSection GetUmbracoSettings() diff --git a/src/Umbraco.Tests/TestHelpers/TestWithDatabaseBase.cs b/src/Umbraco.Tests/TestHelpers/TestWithDatabaseBase.cs index b08376fe8a..25a0dc72fa 100644 --- a/src/Umbraco.Tests/TestHelpers/TestWithDatabaseBase.cs +++ b/src/Umbraco.Tests/TestHelpers/TestWithDatabaseBase.cs @@ -78,7 +78,7 @@ namespace Umbraco.Tests.TestHelpers Container.Register(); Container.Register(factory => PublishedSnapshotService); - Container.Register(factory => SystemDefaultCultureAccessor); + Container.Register(factory => DefaultCultureAccessor); Container.GetInstance() .Clear() @@ -231,7 +231,7 @@ namespace Umbraco.Tests.TestHelpers } } - protected ISystemDefaultCultureAccessor SystemDefaultCultureAccessor { get; set; } + protected IDefaultCultureAccessor DefaultCultureAccessor { get; set; } protected IPublishedSnapshotService PublishedSnapshotService { get; set; } @@ -239,7 +239,7 @@ namespace Umbraco.Tests.TestHelpers { base.Initialize(); - SystemDefaultCultureAccessor = new TestSystemDefaultCultureAccessor(); + DefaultCultureAccessor = new TestDefaultCultureAccessor(); CreateAndInitializeDatabase(); @@ -264,14 +264,14 @@ namespace Umbraco.Tests.TestHelpers // testing=true so XmlStore will not use the file nor the database var publishedSnapshotAccessor = new UmbracoContextPublishedSnapshotAccessor(Umbraco.Web.Composing.Current.UmbracoContextAccessor); - var variationContextAccessor = new TestCurrentVariationAccessor(); + var variationContextAccessor = new TestVariationContextAccessor(); var service = new PublishedSnapshotService( ServiceContext, Container.GetInstance(), ScopeProvider, cache, publishedSnapshotAccessor, variationContextAccessor, Container.GetInstance(), Container.GetInstance(), Container.GetInstance(), - SystemDefaultCultureAccessor, + DefaultCultureAccessor, Logger, Container.GetInstance(), new SiteDomainHelper(), ContentTypesCache, @@ -379,7 +379,7 @@ namespace Umbraco.Tests.TestHelpers umbracoSettings ?? Container.GetInstance(), urlProviders ?? Enumerable.Empty(), globalSettings ?? Container.GetInstance(), - new TestCurrentVariationAccessor()); + new TestVariationContextAccessor()); if (setSingleton) Umbraco.Web.Composing.Current.UmbracoContextAccessor.UmbracoContext = umbracoContext; diff --git a/src/Umbraco.Tests/Testing/Objects/Accessors/TestSystemDefaultCultureAccessor.cs b/src/Umbraco.Tests/Testing/Objects/Accessors/TestDefaultCultureAccessor.cs similarity index 79% rename from src/Umbraco.Tests/Testing/Objects/Accessors/TestSystemDefaultCultureAccessor.cs rename to src/Umbraco.Tests/Testing/Objects/Accessors/TestDefaultCultureAccessor.cs index 6d78f0d290..41bd70626c 100644 --- a/src/Umbraco.Tests/Testing/Objects/Accessors/TestSystemDefaultCultureAccessor.cs +++ b/src/Umbraco.Tests/Testing/Objects/Accessors/TestDefaultCultureAccessor.cs @@ -2,7 +2,7 @@ namespace Umbraco.Tests.Testing.Objects.Accessors { - public class TestSystemDefaultCultureAccessor : ISystemDefaultCultureAccessor + public class TestDefaultCultureAccessor : IDefaultCultureAccessor { private string _defaultCulture = string.Empty; diff --git a/src/Umbraco.Tests/Testing/Objects/Accessors/TestCurrentVariationAccessor.cs b/src/Umbraco.Tests/Testing/Objects/Accessors/TestVariationContextAccessor.cs similarity index 52% rename from src/Umbraco.Tests/Testing/Objects/Accessors/TestCurrentVariationAccessor.cs rename to src/Umbraco.Tests/Testing/Objects/Accessors/TestVariationContextAccessor.cs index 3b2ad36f00..3c7377f2cc 100644 --- a/src/Umbraco.Tests/Testing/Objects/Accessors/TestCurrentVariationAccessor.cs +++ b/src/Umbraco.Tests/Testing/Objects/Accessors/TestVariationContextAccessor.cs @@ -3,12 +3,12 @@ namespace Umbraco.Tests.Testing.Objects.Accessors { /// - /// Provides an implementation of for tests. + /// Provides an implementation of for tests. /// - public class TestCurrentVariationAccessor : ICurrentVariationAccessor + public class TestVariationContextAccessor : IVariationContextAccessor { /// - public CurrentVariation CurrentVariation + public VariationContext VariationContext { get; set; diff --git a/src/Umbraco.Tests/Testing/TestingTests/MockTests.cs b/src/Umbraco.Tests/Testing/TestingTests/MockTests.cs index bf4169e723..f21a953ae7 100644 --- a/src/Umbraco.Tests/Testing/TestingTests/MockTests.cs +++ b/src/Umbraco.Tests/Testing/TestingTests/MockTests.cs @@ -81,7 +81,7 @@ namespace Umbraco.Tests.Testing.TestingTests .Returns("/hello/world/1234"); var urlProvider = urlProviderMock.Object; - var theUrlProvider = new UrlProvider(umbracoContext, new [] { urlProvider }, umbracoContext.CurrentVariationAccessor); + var theUrlProvider = new UrlProvider(umbracoContext, new [] { urlProvider }, umbracoContext.VariationContextAccessor); var contentType = new PublishedContentType(666, "alias", PublishedItemType.Content, Enumerable.Empty(), Enumerable.Empty(), ContentVariation.InvariantNeutral); diff --git a/src/Umbraco.Tests/Umbraco.Tests.csproj b/src/Umbraco.Tests/Umbraco.Tests.csproj index bf8dc2285a..a80728838b 100644 --- a/src/Umbraco.Tests/Umbraco.Tests.csproj +++ b/src/Umbraco.Tests/Umbraco.Tests.csproj @@ -181,9 +181,9 @@ - + - + diff --git a/src/Umbraco.Tests/Web/Mvc/RenderIndexActionSelectorAttributeTests.cs b/src/Umbraco.Tests/Web/Mvc/RenderIndexActionSelectorAttributeTests.cs index 240cf2369a..f4c15f7c19 100644 --- a/src/Umbraco.Tests/Web/Mvc/RenderIndexActionSelectorAttributeTests.cs +++ b/src/Umbraco.Tests/Web/Mvc/RenderIndexActionSelectorAttributeTests.cs @@ -73,7 +73,7 @@ namespace Umbraco.Tests.Web.Mvc TestObjects.GetUmbracoSettings(), Enumerable.Empty(), globalSettings, - new TestCurrentVariationAccessor(), + new TestVariationContextAccessor(), true); var ctrl = new MatchesDefaultIndexController { UmbracoContext = umbCtx }; var controllerCtx = new ControllerContext(req, ctrl); @@ -97,7 +97,7 @@ namespace Umbraco.Tests.Web.Mvc TestObjects.GetUmbracoSettings(), Enumerable.Empty(), globalSettings, - new TestCurrentVariationAccessor(), + new TestVariationContextAccessor(), true); var ctrl = new MatchesOverriddenIndexController { UmbracoContext = umbCtx }; var controllerCtx = new ControllerContext(req, ctrl); @@ -121,7 +121,7 @@ namespace Umbraco.Tests.Web.Mvc TestObjects.GetUmbracoSettings(), Enumerable.Empty(), globalSettings, - new TestCurrentVariationAccessor(), + new TestVariationContextAccessor(), true); var ctrl = new MatchesCustomIndexController { UmbracoContext = umbCtx }; var controllerCtx = new ControllerContext(req, ctrl); @@ -145,7 +145,7 @@ namespace Umbraco.Tests.Web.Mvc TestObjects.GetUmbracoSettings(), Enumerable.Empty(), globalSettings, - new TestCurrentVariationAccessor(), + new TestVariationContextAccessor(), true); var ctrl = new MatchesAsyncIndexController { UmbracoContext = umbCtx }; var controllerCtx = new ControllerContext(req, ctrl); diff --git a/src/Umbraco.Tests/Web/Mvc/SurfaceControllerTests.cs b/src/Umbraco.Tests/Web/Mvc/SurfaceControllerTests.cs index 7ca258affc..4186c56636 100644 --- a/src/Umbraco.Tests/Web/Mvc/SurfaceControllerTests.cs +++ b/src/Umbraco.Tests/Web/Mvc/SurfaceControllerTests.cs @@ -46,7 +46,7 @@ namespace Umbraco.Tests.Web.Mvc TestObjects.GetUmbracoSettings(), Enumerable.Empty(), globalSettings, - new TestCurrentVariationAccessor(), + new TestVariationContextAccessor(), true); var ctrl = new TestSurfaceController { UmbracoContext = umbracoContext }; @@ -68,7 +68,7 @@ namespace Umbraco.Tests.Web.Mvc TestObjects.GetUmbracoSettings(), Enumerable.Empty(), globalSettings, - new TestCurrentVariationAccessor(), + new TestVariationContextAccessor(), true); var ctrl = new TestSurfaceController { UmbracoContext = umbCtx }; @@ -88,7 +88,7 @@ namespace Umbraco.Tests.Web.Mvc TestObjects.GetUmbracoSettings(), Enumerable.Empty(), globalSettings, - new TestCurrentVariationAccessor(), + new TestVariationContextAccessor(), true); var controller = new TestSurfaceController { UmbracoContext = umbracoContext }; @@ -115,7 +115,7 @@ namespace Umbraco.Tests.Web.Mvc Mock.Of(section => section.WebRouting == Mock.Of(routingSection => routingSection.UrlProviderMode == "AutoLegacy")), Enumerable.Empty(), globalSettings, - new TestCurrentVariationAccessor(), + new TestVariationContextAccessor(), true); var helper = new UmbracoHelper( @@ -153,7 +153,7 @@ namespace Umbraco.Tests.Web.Mvc Mock.Of(section => section.WebRouting == webRoutingSettings), Enumerable.Empty(), globalSettings, - new TestCurrentVariationAccessor(), + new TestVariationContextAccessor(), true); var content = Mock.Of(publishedContent => publishedContent.Id == 12345); diff --git a/src/Umbraco.Tests/Web/Mvc/UmbracoViewPageTests.cs b/src/Umbraco.Tests/Web/Mvc/UmbracoViewPageTests.cs index fba1e6b4f6..d5ac55827d 100644 --- a/src/Umbraco.Tests/Web/Mvc/UmbracoViewPageTests.cs +++ b/src/Umbraco.Tests/Web/Mvc/UmbracoViewPageTests.cs @@ -427,7 +427,7 @@ namespace Umbraco.Tests.Web.Mvc _service = new PublishedSnapshotService(svcCtx, factory, scopeProvider, cache, Enumerable.Empty(), null, null, null, null, null, - new TestSystemDefaultCultureAccessor(), + new TestDefaultCultureAccessor(), Current.Logger, TestObjects.GetGlobalSettings(), new SiteDomainHelper(), null, true, false); // no events var http = GetHttpContextFactory(url, routeData).HttpContext; @@ -441,7 +441,7 @@ namespace Umbraco.Tests.Web.Mvc TestObjects.GetUmbracoSettings(), Enumerable.Empty(), globalSettings, - new TestCurrentVariationAccessor()); + new TestVariationContextAccessor()); //if (setSingleton) //{ diff --git a/src/Umbraco.Tests/Web/TemplateUtilitiesTests.cs b/src/Umbraco.Tests/Web/TemplateUtilitiesTests.cs index 571f74089d..c6f7d8551e 100644 --- a/src/Umbraco.Tests/Web/TemplateUtilitiesTests.cs +++ b/src/Umbraco.Tests/Web/TemplateUtilitiesTests.cs @@ -104,7 +104,7 @@ namespace Umbraco.Tests.Web //pass in the custom url provider new[]{ testUrlProvider.Object }, globalSettings, - new TestCurrentVariationAccessor(), + new TestVariationContextAccessor(), true)) { var output = TemplateUtilities.ParseInternalLinks(input, umbCtx.UrlProvider); diff --git a/src/Umbraco.Tests/Web/WebExtensionMethodTests.cs b/src/Umbraco.Tests/Web/WebExtensionMethodTests.cs index 2cc5861156..21b72a3832 100644 --- a/src/Umbraco.Tests/Web/WebExtensionMethodTests.cs +++ b/src/Umbraco.Tests/Web/WebExtensionMethodTests.cs @@ -32,7 +32,7 @@ namespace Umbraco.Tests.Web TestObjects.GetUmbracoSettings(), new List(), TestObjects.GetGlobalSettings(), - new TestCurrentVariationAccessor()); + new TestVariationContextAccessor()); var r1 = new RouteData(); r1.DataTokens.Add(Core.Constants.Web.UmbracoContextDataToken, umbCtx); @@ -50,7 +50,7 @@ namespace Umbraco.Tests.Web TestObjects.GetUmbracoSettings(), new List(), TestObjects.GetGlobalSettings(), - new TestCurrentVariationAccessor()); + new TestVariationContextAccessor()); var r1 = new RouteData(); r1.DataTokens.Add(Core.Constants.Web.UmbracoContextDataToken, umbCtx); @@ -78,7 +78,7 @@ namespace Umbraco.Tests.Web TestObjects.GetUmbracoSettings(), new List(), TestObjects.GetGlobalSettings(), - new TestCurrentVariationAccessor()); + new TestVariationContextAccessor()); var httpContext = Mock.Of(); diff --git a/src/Umbraco.Web/Cache/CacheRefresherComponent.cs b/src/Umbraco.Web/Cache/CacheRefresherComponent.cs index 5e3d2658f7..2ee0ff5f84 100644 --- a/src/Umbraco.Web/Cache/CacheRefresherComponent.cs +++ b/src/Umbraco.Web/Cache/CacheRefresherComponent.cs @@ -237,7 +237,7 @@ namespace Umbraco.Web.Cache UmbracoConfig.For.UmbracoSettings(), Current.UrlProviders, UmbracoConfig.For.GlobalSettings(), - Current.Container.GetInstance(), + Current.Container.GetInstance(), true); } diff --git a/src/Umbraco.Web/Editors/MacroController.cs b/src/Umbraco.Web/Editors/MacroController.cs index bc0d1f4a0c..0d765e9241 100644 --- a/src/Umbraco.Web/Editors/MacroController.cs +++ b/src/Umbraco.Web/Editors/MacroController.cs @@ -27,11 +27,11 @@ namespace Umbraco.Web.Editors [PluginController("UmbracoApi")] public class MacroController : UmbracoAuthorizedJsonController, IRequiresSessionState { - private readonly ICurrentVariationAccessor _variationAccessor; + private readonly IVariationContextAccessor _variationContextAccessor; - public MacroController(ICurrentVariationAccessor variationAccessor) + public MacroController(IVariationContextAccessor variationContextAccessor) { - _variationAccessor = variationAccessor; + _variationContextAccessor = variationContextAccessor; } /// @@ -121,7 +121,7 @@ namespace Umbraco.Web.Editors //the 'easiest' way might be to create an IPublishedContent manually and populate the legacy 'page' object with that //and then set the legacy parameters. - var legacyPage = new global::umbraco.page(doc, _variationAccessor); + var legacyPage = new global::umbraco.page(doc, _variationContextAccessor); UmbracoContext.HttpContext.Items["pageID"] = doc.Id; UmbracoContext.HttpContext.Items["pageElements"] = legacyPage.Elements; UmbracoContext.HttpContext.Items[global::Umbraco.Core.Constants.Conventions.Url.AltTemplate] = null; diff --git a/src/Umbraco.Web/PublishedCache/SystemDefaultCultureAccessor.cs b/src/Umbraco.Web/PublishedCache/DefaultCultureAccessor.cs similarity index 58% rename from src/Umbraco.Web/PublishedCache/SystemDefaultCultureAccessor.cs rename to src/Umbraco.Web/PublishedCache/DefaultCultureAccessor.cs index ced9a0e134..80d2d9f3a5 100644 --- a/src/Umbraco.Web/PublishedCache/SystemDefaultCultureAccessor.cs +++ b/src/Umbraco.Web/PublishedCache/DefaultCultureAccessor.cs @@ -3,17 +3,17 @@ namespace Umbraco.Web.PublishedCache { /// - /// Provides the default implementation of . + /// Provides the default implementation of . /// - public class SystemDefaultCultureAccessor : ISystemDefaultCultureAccessor + public class DefaultCultureAccessor : IDefaultCultureAccessor { private readonly ILocalizationService _localizationService; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - public SystemDefaultCultureAccessor(ILocalizationService localizationService) + public DefaultCultureAccessor(ILocalizationService localizationService) { _localizationService = localizationService; } diff --git a/src/Umbraco.Web/PublishedCache/ISystemDefaultCultureAccessor.cs b/src/Umbraco.Web/PublishedCache/IDefaultCultureAccessor.cs similarity index 80% rename from src/Umbraco.Web/PublishedCache/ISystemDefaultCultureAccessor.cs rename to src/Umbraco.Web/PublishedCache/IDefaultCultureAccessor.cs index 080149864b..b1c1edd4ee 100644 --- a/src/Umbraco.Web/PublishedCache/ISystemDefaultCultureAccessor.cs +++ b/src/Umbraco.Web/PublishedCache/IDefaultCultureAccessor.cs @@ -1,9 +1,9 @@ namespace Umbraco.Web.PublishedCache { /// - /// Provides the system default culture. + /// Gives access to the default culture. /// - public interface ISystemDefaultCultureAccessor + public interface IDefaultCultureAccessor { /// /// Gets the system default culture. diff --git a/src/Umbraco.Web/PublishedCache/NuCache/ContentNode.cs b/src/Umbraco.Web/PublishedCache/NuCache/ContentNode.cs index 1a562dad79..2c2101b066 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/ContentNode.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/ContentNode.cs @@ -34,10 +34,10 @@ namespace Umbraco.Web.PublishedCache.NuCache DateTime createDate, int creatorId, ContentData draftData, ContentData publishedData, IPublishedSnapshotAccessor publishedSnapshotAccessor, - ICurrentVariationAccessor variationAccessor) + IVariationContextAccessor variationContextAccessor) : this(id, uid, level, path, sortOrder, parentContentId, createDate, creatorId) { - SetContentTypeAndData(contentType, draftData, publishedData, publishedSnapshotAccessor, variationAccessor); + SetContentTypeAndData(contentType, draftData, publishedData, publishedSnapshotAccessor, variationContextAccessor); } // 2-phases ctor, phase 1 @@ -59,7 +59,7 @@ namespace Umbraco.Web.PublishedCache.NuCache } // two-phase ctor, phase 2 - public void SetContentTypeAndData(PublishedContentType contentType, ContentData draftData, ContentData publishedData, IPublishedSnapshotAccessor publishedSnapshotAccessor, ICurrentVariationAccessor variationAccessor) + public void SetContentTypeAndData(PublishedContentType contentType, ContentData draftData, ContentData publishedData, IPublishedSnapshotAccessor publishedSnapshotAccessor, IVariationContextAccessor variationContextAccessor) { ContentType = contentType; @@ -67,9 +67,9 @@ namespace Umbraco.Web.PublishedCache.NuCache throw new ArgumentException("Both draftData and publishedData cannot be null at the same time."); if (draftData != null) - Draft = new PublishedContent(this, draftData, publishedSnapshotAccessor, variationAccessor).CreateModel(); + Draft = new PublishedContent(this, draftData, publishedSnapshotAccessor, variationContextAccessor).CreateModel(); if (publishedData != null) - Published = new PublishedContent(this, publishedData, publishedSnapshotAccessor, variationAccessor).CreateModel(); + Published = new PublishedContent(this, publishedData, publishedSnapshotAccessor, variationContextAccessor).CreateModel(); } // clone parent @@ -98,7 +98,7 @@ namespace Umbraco.Web.PublishedCache.NuCache } // clone with new content type - public ContentNode(ContentNode origin, PublishedContentType contentType, IPublishedSnapshotAccessor publishedSnapshotAccessor, ICurrentVariationAccessor variationAccessor) + public ContentNode(ContentNode origin, PublishedContentType contentType, IPublishedSnapshotAccessor publishedSnapshotAccessor, IVariationContextAccessor variationContextAccessor) { Id = origin.Id; Uid = origin.Uid; @@ -113,8 +113,8 @@ namespace Umbraco.Web.PublishedCache.NuCache var originDraft = origin.Draft == null ? null : PublishedContent.UnwrapIPublishedContent(origin.Draft); var originPublished = origin.Published == null ? null : PublishedContent.UnwrapIPublishedContent(origin.Published); - Draft = originDraft == null ? null : new PublishedContent(this, originDraft._contentData, publishedSnapshotAccessor, variationAccessor).CreateModel(); - Published = originPublished == null ? null : new PublishedContent(this, originPublished._contentData, publishedSnapshotAccessor, variationAccessor).CreateModel(); + Draft = originDraft == null ? null : new PublishedContent(this, originDraft._contentData, publishedSnapshotAccessor, variationContextAccessor).CreateModel(); + Published = originPublished == null ? null : new PublishedContent(this, originPublished._contentData, publishedSnapshotAccessor, variationContextAccessor).CreateModel(); ChildContentIds = origin.ChildContentIds; // can be the *same* list FIXME oh really? } diff --git a/src/Umbraco.Web/PublishedCache/NuCache/ContentNodeKit.cs b/src/Umbraco.Web/PublishedCache/NuCache/ContentNodeKit.cs index d4d4221bf0..f284d54cf1 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/ContentNodeKit.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/ContentNodeKit.cs @@ -17,9 +17,9 @@ namespace Umbraco.Web.PublishedCache.NuCache public static ContentNodeKit Null { get; } = new ContentNodeKit { ContentTypeId = -1 }; - public void Build(PublishedContentType contentType, IPublishedSnapshotAccessor publishedSnapshotAccessor, ICurrentVariationAccessor variationAccessor) + public void Build(PublishedContentType contentType, IPublishedSnapshotAccessor publishedSnapshotAccessor, IVariationContextAccessor variationContextAccessor) { - Node.SetContentTypeAndData(contentType, DraftData, PublishedData, publishedSnapshotAccessor, variationAccessor); + 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 b19e9f5ddf..8a22259204 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/ContentStore.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/ContentStore.cs @@ -19,7 +19,7 @@ namespace Umbraco.Web.PublishedCache.NuCache // SnapDictionary has unit tests to ensure it all works correctly private readonly IPublishedSnapshotAccessor _publishedSnapshotAccessor; - private readonly ICurrentVariationAccessor _variationAccessor; + private readonly IVariationContextAccessor _variationContextAccessor; private readonly ConcurrentDictionary> _contentNodes; private readonly ConcurrentDictionary> _contentRootNodes; private readonly ConcurrentDictionary> _contentTypesById; @@ -44,10 +44,10 @@ namespace Umbraco.Web.PublishedCache.NuCache #region Ctor - public ContentStore(IPublishedSnapshotAccessor publishedSnapshotAccessor, ICurrentVariationAccessor variationAccessor, ILogger logger, BPlusTree localDb = null) + public ContentStore(IPublishedSnapshotAccessor publishedSnapshotAccessor, IVariationContextAccessor variationContextAccessor, ILogger logger, BPlusTree localDb = null) { _publishedSnapshotAccessor = publishedSnapshotAccessor; - _variationAccessor = variationAccessor; + _variationContextAccessor = variationContextAccessor; _logger = logger; _localDb = localDb; @@ -279,7 +279,7 @@ namespace Umbraco.Web.PublishedCache.NuCache if (node == null) continue; var contentTypeId = node.ContentType.Id; if (index.TryGetValue(contentTypeId, out PublishedContentType contentType) == false) continue; - SetValueLocked(_contentNodes, node.Id, new ContentNode(node, contentType, _publishedSnapshotAccessor, _variationAccessor)); + SetValueLocked(_contentNodes, node.Id, new ContentNode(node, contentType, _publishedSnapshotAccessor, _variationContextAccessor)); } } finally @@ -393,7 +393,7 @@ namespace Umbraco.Web.PublishedCache.NuCache _contentNodes.TryGetValue(id, out LinkedNode link); if (link?.Value == null) continue; - var node = new ContentNode(link.Value, contentType, _publishedSnapshotAccessor, _variationAccessor); + var node = new ContentNode(link.Value, contentType, _publishedSnapshotAccessor, _variationContextAccessor); SetValueLocked(_contentNodes, id, node); if (_localDb != null) RegisterChange(id, node.ToKit()); } @@ -416,7 +416,7 @@ namespace Umbraco.Web.PublishedCache.NuCache return false; // and use - kit.Build(link.Value, _publishedSnapshotAccessor, _variationAccessor); + kit.Build(link.Value, _publishedSnapshotAccessor, _variationContextAccessor); return true; } diff --git a/src/Umbraco.Web/PublishedCache/NuCache/MemberCache.cs b/src/Umbraco.Web/PublishedCache/NuCache/MemberCache.cs index 61f3d9862d..ce8b5835e2 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/MemberCache.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/MemberCache.cs @@ -16,7 +16,7 @@ namespace Umbraco.Web.PublishedCache.NuCache class MemberCache : IPublishedMemberCache, INavigableData { private readonly IPublishedSnapshotAccessor _publishedSnapshotAccessor; - public readonly ICurrentVariationAccessor VariationAccessor; + public readonly IVariationContextAccessor VariationContextAccessor; private readonly ICacheProvider _snapshotCache; private readonly IMemberService _memberService; private readonly IDataTypeService _dataTypeService; @@ -24,11 +24,11 @@ namespace Umbraco.Web.PublishedCache.NuCache private readonly PublishedContentTypeCache _contentTypeCache; private readonly bool _previewDefault; - public MemberCache(bool previewDefault, ICacheProvider snapshotCache, IMemberService memberService, IDataTypeService dataTypeService, ILocalizationService localizationService, PublishedContentTypeCache contentTypeCache, IPublishedSnapshotAccessor publishedSnapshotAccessor, ICurrentVariationAccessor variationAccessor) + public MemberCache(bool previewDefault, ICacheProvider snapshotCache, IMemberService memberService, IDataTypeService dataTypeService, ILocalizationService localizationService, PublishedContentTypeCache contentTypeCache, IPublishedSnapshotAccessor publishedSnapshotAccessor, IVariationContextAccessor variationContextAccessor) { _snapshotCache = snapshotCache; _publishedSnapshotAccessor = publishedSnapshotAccessor; - VariationAccessor = variationAccessor; + VariationContextAccessor = variationContextAccessor; _memberService = memberService; _dataTypeService = dataTypeService; _localizationService = localizationService; @@ -65,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, VariationAccessor); + : 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, VariationAccessor)); + PublishedMember.Create(member, GetContentType(member.ContentTypeId), previewing, _publishedSnapshotAccessor, VariationContextAccessor)); } public IPublishedContent /*IPublishedMember*/ GetByProviderKey(object key) @@ -107,7 +107,7 @@ namespace Umbraco.Web.PublishedCache.NuCache public IPublishedContent /*IPublishedMember*/ GetByMember(IMember member) { - return PublishedMember.Create(member, GetContentType(member.ContentTypeId), _previewDefault, _publishedSnapshotAccessor, VariationAccessor); + return PublishedMember.Create(member, GetContentType(member.ContentTypeId), _previewDefault, _publishedSnapshotAccessor, VariationContextAccessor); } public IEnumerable GetAtRoot(bool preview) @@ -115,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, VariationAccessor)); + return members.Select(m => PublishedMember.Create(m, GetContentType(m.ContentTypeId), preview, _publishedSnapshotAccessor, VariationContextAccessor)); } public XPathNavigator CreateNavigator() diff --git a/src/Umbraco.Web/PublishedCache/NuCache/Property.cs b/src/Umbraco.Web/PublishedCache/NuCache/Property.cs index 22e10c1cb7..0c48b4b52c 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/Property.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/Property.cs @@ -191,7 +191,7 @@ namespace Umbraco.Web.PublishedCache.NuCache // use context values // fixme CultureSegment? - var publishedVariationContext = _content.VariationAccessor?.CurrentVariation; + var publishedVariationContext = _content.VariationContextAccessor?.VariationContext; if (culture == null) culture = _variations.Has(ContentVariation.CultureNeutral) ? publishedVariationContext?.Culture : ""; if (segment == null) segment = _variations.Has(ContentVariation.CultureNeutral) ? publishedVariationContext?.Segment : ""; } diff --git a/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs b/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs index 5382c3e184..844f962056 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs @@ -22,12 +22,12 @@ namespace Umbraco.Web.PublishedCache.NuCache #region Constructors - public PublishedContent(ContentNode contentNode, ContentData contentData, IPublishedSnapshotAccessor publishedSnapshotAccessor, ICurrentVariationAccessor variationAccessor) + public PublishedContent(ContentNode contentNode, ContentData contentData, IPublishedSnapshotAccessor publishedSnapshotAccessor, IVariationContextAccessor variationContextAccessor) { _contentNode = contentNode; _contentData = contentData; _publishedSnapshotAccessor = publishedSnapshotAccessor; - VariationAccessor = variationAccessor; // fixme why is this a property? should be be on the base class? + VariationContextAccessor = variationContextAccessor; // fixme why is this a property? should be be on the base class? _urlSegment = _contentData.Name.ToUrlSegment(); IsPreviewing = _contentData.Published == false; @@ -70,7 +70,7 @@ namespace Umbraco.Web.PublishedCache.NuCache { _contentNode = contentNode; _publishedSnapshotAccessor = origin._publishedSnapshotAccessor; - VariationAccessor = origin.VariationAccessor; + VariationContextAccessor = origin.VariationContextAccessor; _contentData = origin._contentData; _urlSegment = origin._urlSegment; @@ -86,7 +86,7 @@ namespace Umbraco.Web.PublishedCache.NuCache private PublishedContent(PublishedContent origin) { _publishedSnapshotAccessor = origin._publishedSnapshotAccessor; - VariationAccessor = origin.VariationAccessor; + VariationContextAccessor = origin.VariationContextAccessor; _contentNode = origin._contentNode; _contentData = origin._contentData; @@ -181,7 +181,7 @@ namespace Umbraco.Web.PublishedCache.NuCache if (!ContentType.Variations.Has(ContentVariation.CultureNeutral)) // fixme CultureSegment? return _contentData.Name; - var culture = VariationAccessor.CurrentVariation.Culture; + var culture = VariationContextAccessor.VariationContext.Culture; if (culture == "") return _contentData.Name; @@ -197,7 +197,7 @@ namespace Umbraco.Web.PublishedCache.NuCache if (!ContentType.Variations.Has(ContentVariation.CultureNeutral)) // fixme CultureSegment? return _urlSegment; - var culture = VariationAccessor.CurrentVariation.Culture; + var culture = VariationContextAccessor.VariationContext.Culture; if (culture == "") return _urlSegment; @@ -244,7 +244,7 @@ namespace Umbraco.Web.PublishedCache.NuCache { // handle context culture if (culture == null) - culture = VariationAccessor.CurrentVariation.Culture; + culture = VariationContextAccessor.VariationContext.Culture; // no invariant culture infos if (culture == "") return null; @@ -397,7 +397,7 @@ namespace Umbraco.Web.PublishedCache.NuCache #region Internal - internal ICurrentVariationAccessor VariationAccessor { get; } + internal IVariationContextAccessor VariationContextAccessor { get; } // used by navigable content internal IPublishedProperty[] PropertiesArray { get; } diff --git a/src/Umbraco.Web/PublishedCache/NuCache/PublishedMember.cs b/src/Umbraco.Web/PublishedCache/NuCache/PublishedMember.cs index 4e01df0cd9..47c8d738f1 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/PublishedMember.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/PublishedMember.cs @@ -15,13 +15,13 @@ namespace Umbraco.Web.PublishedCache.NuCache { private readonly IMember _member; - private PublishedMember(IMember member, ContentNode contentNode, ContentData contentData, IPublishedSnapshotAccessor publishedSnapshotAccessor, ICurrentVariationAccessor variationAccessor) - : base(contentNode, contentData, publishedSnapshotAccessor, variationAccessor) + private PublishedMember(IMember member, ContentNode contentNode, ContentData contentData, IPublishedSnapshotAccessor publishedSnapshotAccessor, IVariationContextAccessor variationContextAccessor) + : base(contentNode, contentData, publishedSnapshotAccessor, variationContextAccessor) { _member = member; } - public static IPublishedContent Create(IMember member, PublishedContentType contentType, bool previewing, IPublishedSnapshotAccessor publishedSnapshotAccessor, ICurrentVariationAccessor variationAccessor) + public static IPublishedContent Create(IMember member, PublishedContentType contentType, bool previewing, IPublishedSnapshotAccessor publishedSnapshotAccessor, IVariationContextAccessor variationContextAccessor) { var d = new ContentData { @@ -37,7 +37,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, variationAccessor).CreateModel(); + return new PublishedMember(member, n, d, publishedSnapshotAccessor, variationContextAccessor).CreateModel(); } private static Dictionary GetPropertyValues(PublishedContentType contentType, IMember member) diff --git a/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs b/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs index 3108f24090..8a7f956e56 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs @@ -43,7 +43,7 @@ namespace Umbraco.Web.PublishedCache.NuCache private readonly IMemberRepository _memberRepository; private readonly IGlobalSettings _globalSettings; private readonly ISiteDomainHelper _siteDomainHelper; - private readonly ISystemDefaultCultureAccessor _systemDefaultCultureAccessor; + private readonly IDefaultCultureAccessor _defaultCultureAccessor; // volatile because we read it with no lock private volatile bool _isReady; @@ -81,12 +81,12 @@ namespace Umbraco.Web.PublishedCache.NuCache public PublishedSnapshotService(Options options, MainDom mainDom, IRuntimeState runtime, ServiceContext serviceContext, IPublishedContentTypeFactory publishedContentTypeFactory, IdkMap idkMap, - IPublishedSnapshotAccessor publishedSnapshotAccessor, ICurrentVariationAccessor variationAccessor, + IPublishedSnapshotAccessor publishedSnapshotAccessor, IVariationContextAccessor variationContextAccessor, ILogger logger, IScopeProvider scopeProvider, IDocumentRepository documentRepository, IMediaRepository mediaRepository, IMemberRepository memberRepository, - ISystemDefaultCultureAccessor systemDefaultCultureAccessor, + IDefaultCultureAccessor defaultCultureAccessor, IDataSource dataSource, IGlobalSettings globalSettings, ISiteDomainHelper siteDomainHelper) - : base(publishedSnapshotAccessor, variationAccessor) + : base(publishedSnapshotAccessor, variationContextAccessor) { //if (Interlocked.Increment(ref _singletonCheck) > 1) // throw new Exception("Singleton must be instancianted only once!"); @@ -99,7 +99,7 @@ namespace Umbraco.Web.PublishedCache.NuCache _documentRepository = documentRepository; _mediaRepository = mediaRepository; _memberRepository = memberRepository; - _systemDefaultCultureAccessor = systemDefaultCultureAccessor; + _defaultCultureAccessor = defaultCultureAccessor; _globalSettings = globalSettings; _siteDomainHelper = siteDomainHelper; @@ -145,13 +145,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 dbs or it should populate them from sql - _contentStore = new ContentStore(publishedSnapshotAccessor, variationAccessor, logger, _localContentDb); - _mediaStore = new ContentStore(publishedSnapshotAccessor, variationAccessor, logger, _localMediaDb); + _contentStore = new ContentStore(publishedSnapshotAccessor, variationContextAccessor, logger, _localContentDb); + _mediaStore = new ContentStore(publishedSnapshotAccessor, variationContextAccessor, logger, _localMediaDb); } else { - _contentStore = new ContentStore(publishedSnapshotAccessor, variationAccessor, logger); - _mediaStore = new ContentStore(publishedSnapshotAccessor, variationAccessor, logger); + _contentStore = new ContentStore(publishedSnapshotAccessor, variationContextAccessor, logger); + _mediaStore = new ContentStore(publishedSnapshotAccessor, variationContextAccessor, logger); } _domainStore = new SnapDictionary(); @@ -996,7 +996,7 @@ namespace Umbraco.Web.PublishedCache.NuCache var memberTypeCache = new PublishedContentTypeCache(null, null, _serviceContext.MemberTypeService, _publishedContentTypeFactory, _logger); - var defaultCulture = _systemDefaultCultureAccessor.DefaultCulture; + var defaultCulture = _defaultCultureAccessor.DefaultCulture; var domainCache = new DomainCache(domainSnap, defaultCulture); var domainHelper = new DomainHelper(domainCache, _siteDomainHelper); @@ -1004,7 +1004,7 @@ namespace Umbraco.Web.PublishedCache.NuCache { ContentCache = new ContentCache(previewDefault, contentSnap, snapshotCache, elementsCache, domainHelper, _globalSettings, _serviceContext.LocalizationService), MediaCache = new MediaCache(previewDefault, mediaSnap, snapshotCache, elementsCache), - MemberCache = new MemberCache(previewDefault, snapshotCache, _serviceContext.MemberService, _serviceContext.DataTypeService, _serviceContext.LocalizationService, memberTypeCache, PublishedSnapshotAccessor, VariationAccessor), + MemberCache = new MemberCache(previewDefault, snapshotCache, _serviceContext.MemberService, _serviceContext.DataTypeService, _serviceContext.LocalizationService, memberTypeCache, PublishedSnapshotAccessor, VariationContextAccessor), DomainCache = domainCache, SnapshotCache = snapshotCache, ElementsCache = elementsCache diff --git a/src/Umbraco.Web/PublishedCache/PublishedSnapshotServiceBase.cs b/src/Umbraco.Web/PublishedCache/PublishedSnapshotServiceBase.cs index b5d721e03c..74e08e92e8 100644 --- a/src/Umbraco.Web/PublishedCache/PublishedSnapshotServiceBase.cs +++ b/src/Umbraco.Web/PublishedCache/PublishedSnapshotServiceBase.cs @@ -7,14 +7,14 @@ namespace Umbraco.Web.PublishedCache { abstract class PublishedSnapshotServiceBase : IPublishedSnapshotService { - protected PublishedSnapshotServiceBase(IPublishedSnapshotAccessor publishedSnapshotAccessor, ICurrentVariationAccessor variationAccessor) + protected PublishedSnapshotServiceBase(IPublishedSnapshotAccessor publishedSnapshotAccessor, IVariationContextAccessor variationContextAccessor) { PublishedSnapshotAccessor = publishedSnapshotAccessor; - VariationAccessor = variationAccessor; + VariationContextAccessor = variationContextAccessor; } public IPublishedSnapshotAccessor PublishedSnapshotAccessor { get; } - public ICurrentVariationAccessor VariationAccessor { get; } + public IVariationContextAccessor VariationContextAccessor { get; } // note: NOT setting _publishedSnapshotAccessor.PublishedSnapshot here because it is the // responsibility of the caller to manage what the 'current' facade is diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/DomainCache.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/DomainCache.cs index b0c5033c41..20397c07f8 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/DomainCache.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/DomainCache.cs @@ -11,10 +11,10 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache { private readonly IDomainService _domainService; - public DomainCache(IDomainService domainService, ISystemDefaultCultureAccessor systemDefaultCultureAccessor) + public DomainCache(IDomainService domainService, IDefaultCultureAccessor defaultCultureAccessor) { _domainService = domainService; - DefaultCulture = systemDefaultCultureAccessor.DefaultCulture; + DefaultCulture = defaultCultureAccessor.DefaultCulture; } public IEnumerable GetAll(bool includeWildcards) diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedSnapshotService.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedSnapshotService.cs index ab59fc6aca..78585ba2e2 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedSnapshotService.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedSnapshotService.cs @@ -32,7 +32,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache private readonly IUserService _userService; private readonly ICacheProvider _requestCache; private readonly IGlobalSettings _globalSettings; - private readonly ISystemDefaultCultureAccessor _systemDefaultCultureAccessor; + private readonly IDefaultCultureAccessor _defaultCultureAccessor; private readonly ISiteDomainHelper _siteDomainHelper; #region Constructors @@ -43,18 +43,18 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache IScopeProvider scopeProvider, ICacheProvider requestCache, IEnumerable segmentProviders, - IPublishedSnapshotAccessor publishedSnapshotAccessor, ICurrentVariationAccessor variationAccessor, + IPublishedSnapshotAccessor publishedSnapshotAccessor, IVariationContextAccessor variationContextAccessor, IDocumentRepository documentRepository, IMediaRepository mediaRepository, IMemberRepository memberRepository, - ISystemDefaultCultureAccessor systemDefaultCultureAccessor, + IDefaultCultureAccessor defaultCultureAccessor, ILogger logger, IGlobalSettings globalSettings, ISiteDomainHelper siteDomainHelper, MainDom mainDom, bool testing = false, bool enableRepositoryEvents = true) : this(serviceContext, publishedContentTypeFactory, scopeProvider, requestCache, segmentProviders, - publishedSnapshotAccessor, variationAccessor, + publishedSnapshotAccessor, variationContextAccessor, documentRepository, mediaRepository, memberRepository, - systemDefaultCultureAccessor, + defaultCultureAccessor, logger, globalSettings, siteDomainHelper, null, mainDom, testing, enableRepositoryEvents) { } @@ -63,9 +63,9 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache IPublishedContentTypeFactory publishedContentTypeFactory, IScopeProvider scopeProvider, ICacheProvider requestCache, - IPublishedSnapshotAccessor publishedSnapshotAccessor, ICurrentVariationAccessor variationAccessor, + IPublishedSnapshotAccessor publishedSnapshotAccessor, IVariationContextAccessor variationContextAccessor, IDocumentRepository documentRepository, IMediaRepository mediaRepository, IMemberRepository memberRepository, - ISystemDefaultCultureAccessor systemDefaultCultureAccessor, + IDefaultCultureAccessor defaultCultureAccessor, ILogger logger, IGlobalSettings globalSettings, ISiteDomainHelper siteDomainHelper, @@ -73,9 +73,9 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache MainDom mainDom, bool testing, bool enableRepositoryEvents) : this(serviceContext, publishedContentTypeFactory, scopeProvider, requestCache, Enumerable.Empty(), - publishedSnapshotAccessor, variationAccessor, + publishedSnapshotAccessor, variationContextAccessor, documentRepository, mediaRepository, memberRepository, - systemDefaultCultureAccessor, + defaultCultureAccessor, logger, globalSettings, siteDomainHelper, contentTypeCache, mainDom, testing, enableRepositoryEvents) { } @@ -84,16 +84,16 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache IScopeProvider scopeProvider, ICacheProvider requestCache, IEnumerable segmentProviders, - IPublishedSnapshotAccessor publishedSnapshotAccessor, ICurrentVariationAccessor variationAccessor, + IPublishedSnapshotAccessor publishedSnapshotAccessor, IVariationContextAccessor variationContextAccessor, IDocumentRepository documentRepository, IMediaRepository mediaRepository, IMemberRepository memberRepository, - ISystemDefaultCultureAccessor systemDefaultCultureAccessor, + IDefaultCultureAccessor defaultCultureAccessor, ILogger logger, IGlobalSettings globalSettings, ISiteDomainHelper siteDomainHelper, PublishedContentTypeCache contentTypeCache, MainDom mainDom, bool testing, bool enableRepositoryEvents) - : base(publishedSnapshotAccessor, variationAccessor) + : base(publishedSnapshotAccessor, variationContextAccessor) { _routesCache = new RoutesCache(); _publishedContentTypeFactory = publishedContentTypeFactory; @@ -108,7 +108,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache _memberService = serviceContext.MemberService; _mediaService = serviceContext.MediaService; _userService = serviceContext.UserService; - _systemDefaultCultureAccessor = systemDefaultCultureAccessor; + _defaultCultureAccessor = defaultCultureAccessor; _requestCache = requestCache; _globalSettings = globalSettings; @@ -153,7 +153,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache // the current caches, but that would mean creating an extra cache (StaticCache // probably) so better use RequestCache. - var domainCache = new DomainCache(_domainService, _systemDefaultCultureAccessor); + var domainCache = new DomainCache(_domainService, _defaultCultureAccessor); return new PublishedSnapshot( new PublishedContentCache(_xmlStore, domainCache, _requestCache, _globalSettings, _siteDomainHelper, _contentTypeCache, _routesCache, previewToken), diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlCacheComponent.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlCacheComponent.cs index 76af7102f5..496818ab28 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlCacheComponent.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlCacheComponent.cs @@ -29,11 +29,11 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache factory.GetInstance().RequestCache, factory.GetInstance(), factory.GetInstance(), - factory.GetInstance(), + factory.GetInstance(), factory.GetInstance(), factory.GetInstance(), factory.GetInstance(), - factory.GetInstance(), + factory.GetInstance(), factory.GetInstance(), factory.GetInstance(), factory.GetInstance(), diff --git a/src/Umbraco.Web/Routing/UrlProvider.cs b/src/Umbraco.Web/Routing/UrlProvider.cs index d2fba48472..a1fd31a127 100644 --- a/src/Umbraco.Web/Routing/UrlProvider.cs +++ b/src/Umbraco.Web/Routing/UrlProvider.cs @@ -22,14 +22,14 @@ namespace Umbraco.Web.Routing /// The Umbraco context. /// Routing settings. /// The list of url providers. - /// The current variation accessor. - public UrlProvider(UmbracoContext umbracoContext, IWebRoutingSection routingSettings, IEnumerable urlProviders, ICurrentVariationAccessor variationAccessor) + /// The current variation accessor. + public UrlProvider(UmbracoContext umbracoContext, IWebRoutingSection routingSettings, IEnumerable urlProviders, IVariationContextAccessor variationContextAccessor) { if (routingSettings == null) throw new ArgumentNullException(nameof(routingSettings)); _umbracoContext = umbracoContext ?? throw new ArgumentNullException(nameof(umbracoContext)); _urlProviders = urlProviders; - _variationAccessor = variationAccessor ?? throw new ArgumentNullException(nameof(variationAccessor)); + _variationContextAccessor = variationContextAccessor ?? throw new ArgumentNullException(nameof(variationContextAccessor)); var provider = UrlProviderMode.Auto; Mode = provider; @@ -44,20 +44,20 @@ namespace Umbraco.Web.Routing /// /// The Umbraco context. /// The list of url providers. - /// The current variation accessor. + /// The current variation accessor. /// An optional provider mode. - public UrlProvider(UmbracoContext umbracoContext, IEnumerable urlProviders, ICurrentVariationAccessor variationAccessor, UrlProviderMode mode = UrlProviderMode.Auto) + public UrlProvider(UmbracoContext umbracoContext, IEnumerable urlProviders, IVariationContextAccessor variationContextAccessor, UrlProviderMode mode = UrlProviderMode.Auto) { _umbracoContext = umbracoContext ?? throw new ArgumentNullException(nameof(umbracoContext)); _urlProviders = urlProviders; - _variationAccessor = variationAccessor; + _variationContextAccessor = variationContextAccessor; Mode = mode; } private readonly UmbracoContext _umbracoContext; private readonly IEnumerable _urlProviders; - private readonly ICurrentVariationAccessor _variationAccessor; + private readonly IVariationContextAccessor _variationContextAccessor; /// /// Gets or sets the provider url mode. @@ -203,7 +203,7 @@ namespace Umbraco.Web.Routing if (culture == null) { culture = content.ContentType.Variations.Has(ContentVariation.CultureNeutral) // fixme CultureSegment - ? _variationAccessor.CurrentVariation.Culture + ? _variationContextAccessor.VariationContext.Culture : null; } diff --git a/src/Umbraco.Web/Runtime/WebRuntimeComponent.cs b/src/Umbraco.Web/Runtime/WebRuntimeComponent.cs index d8602422d5..e472286902 100644 --- a/src/Umbraco.Web/Runtime/WebRuntimeComponent.cs +++ b/src/Umbraco.Web/Runtime/WebRuntimeComponent.cs @@ -71,8 +71,8 @@ namespace Umbraco.Web.Runtime composition.Container.RegisterFrom(); // register accessors for cultures - composition.Container.RegisterSingleton(); - composition.Container.RegisterSingleton(); + composition.Container.RegisterSingleton(); + composition.Container.RegisterSingleton(); var typeLoader = composition.Container.GetInstance(); var logger = composition.Container.GetInstance(); @@ -218,7 +218,7 @@ namespace Umbraco.Web.Runtime IUmbracoSettingsSection umbracoSettings, IGlobalSettings globalSettings, IEntityService entityService, - ICurrentVariationAccessor variationAccessor, + IVariationContextAccessor variationContextAccessor, UrlProviderCollection urlProviders) { // setup mvc and webapi services @@ -256,7 +256,7 @@ namespace Umbraco.Web.Runtime umbracoSettings, urlProviders, globalSettings, - variationAccessor); + variationContextAccessor); // ensure WebAPI is initialized, after everything GlobalConfiguration.Configuration.EnsureInitialized(); diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index e730c0b29c..362802787f 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -343,7 +343,7 @@ - + @@ -389,7 +389,7 @@ - + diff --git a/src/Umbraco.Web/UmbracoContext.cs b/src/Umbraco.Web/UmbracoContext.cs index 53fab2e57a..a88716bec3 100644 --- a/src/Umbraco.Web/UmbracoContext.cs +++ b/src/Umbraco.Web/UmbracoContext.cs @@ -70,7 +70,7 @@ namespace Umbraco.Web IUmbracoSettingsSection umbracoSettings, IEnumerable urlProviders, IGlobalSettings globalSettings, - ICurrentVariationAccessor variationAccessor, + IVariationContextAccessor variationContextAccessor, bool replace = false) { if (umbracoContextAccessor == null) throw new ArgumentNullException(nameof(umbracoContextAccessor)); @@ -88,7 +88,7 @@ namespace Umbraco.Web // create & assign to accessor, dispose existing if any umbracoContextAccessor.UmbracoContext?.Dispose(); - return umbracoContextAccessor.UmbracoContext = new UmbracoContext(httpContext, publishedSnapshotService, webSecurity, umbracoSettings, urlProviders, globalSettings, variationAccessor); + return umbracoContextAccessor.UmbracoContext = new UmbracoContext(httpContext, publishedSnapshotService, webSecurity, umbracoSettings, urlProviders, globalSettings, variationContextAccessor); } // initializes a new instance of the UmbracoContext class @@ -101,14 +101,14 @@ namespace Umbraco.Web IUmbracoSettingsSection umbracoSettings, IEnumerable urlProviders, IGlobalSettings globalSettings, - ICurrentVariationAccessor variationAccessor) + IVariationContextAccessor variationContextAccessor) { if (httpContext == null) throw new ArgumentNullException(nameof(httpContext)); if (publishedSnapshotService == null) throw new ArgumentNullException(nameof(publishedSnapshotService)); if (webSecurity == null) throw new ArgumentNullException(nameof(webSecurity)); if (umbracoSettings == null) throw new ArgumentNullException(nameof(umbracoSettings)); if (urlProviders == null) throw new ArgumentNullException(nameof(urlProviders)); - CurrentVariationAccessor = variationAccessor ?? throw new ArgumentNullException(nameof(variationAccessor)); + VariationContextAccessor = variationContextAccessor ?? throw new ArgumentNullException(nameof(variationContextAccessor)); _globalSettings = globalSettings ?? throw new ArgumentNullException(nameof(globalSettings)); // ensure that this instance is disposed when the request terminates, though we *also* ensure @@ -138,7 +138,7 @@ namespace Umbraco.Web // OriginalRequestUrl = GetRequestFromContext()?.Url ?? new Uri("http://localhost"); CleanedUmbracoUrl = UriUtility.UriToUmbraco(OriginalRequestUrl); - UrlProvider = new UrlProvider(this, umbracoSettings.WebRouting, urlProviders, variationAccessor); + UrlProvider = new UrlProvider(this, umbracoSettings.WebRouting, urlProviders, variationContextAccessor); } #endregion @@ -215,7 +215,7 @@ namespace Umbraco.Web /// public HttpContextBase HttpContext { get; } - public ICurrentVariationAccessor CurrentVariationAccessor { get; } + public IVariationContextAccessor VariationContextAccessor { get; } /// /// Creates and caches an instance of a DomainHelper diff --git a/src/Umbraco.Web/UmbracoModule.cs b/src/Umbraco.Web/UmbracoModule.cs index 5a866939a8..8a2ae4ddb7 100644 --- a/src/Umbraco.Web/UmbracoModule.cs +++ b/src/Umbraco.Web/UmbracoModule.cs @@ -69,7 +69,7 @@ namespace Umbraco.Web internal IUmbracoDatabaseFactory DatabaseFactory { get; set; } [Inject] - internal ICurrentVariationAccessor CurrentVariationAccessor { get; set; } + internal IVariationContextAccessor VariationContextAccessor { get; set; } #endregion @@ -113,7 +113,7 @@ namespace Umbraco.Web UmbracoConfig.For.UmbracoSettings(), UrlProviders, GlobalSettings, - CurrentVariationAccessor, + VariationContextAccessor, true); } diff --git a/src/Umbraco.Web/umbraco.presentation/page.cs b/src/Umbraco.Web/umbraco.presentation/page.cs index e3643aea2c..837882eef4 100644 --- a/src/Umbraco.Web/umbraco.presentation/page.cs +++ b/src/Umbraco.Web/umbraco.presentation/page.cs @@ -108,8 +108,8 @@ namespace umbraco /// /// The content. /// This is for usage only. - internal page(IContent content, ICurrentVariationAccessor variationAccessor) - : this(new PagePublishedContent(content, variationAccessor)) + internal page(IContent content, IVariationContextAccessor variationContextAccessor) + : this(new PagePublishedContent(content, variationContextAccessor)) { } #endregion @@ -409,7 +409,7 @@ namespace umbraco private readonly IPublishedProperty[] _properties; private readonly IPublishedContent _parent; private IReadOnlyDictionary _cultureInfos; - private readonly ICurrentVariationAccessor _variationAccessor; + private readonly IVariationContextAccessor _variationContextAccessor; private static readonly IReadOnlyDictionary NoCultureInfos = new Dictionary(); @@ -418,13 +418,13 @@ namespace umbraco _id = id; } - public PagePublishedContent(IContent inner, ICurrentVariationAccessor variationAccessor) + public PagePublishedContent(IContent inner, IVariationContextAccessor variationContextAccessor) { if (inner == null) throw new NullReferenceException("content"); _inner = inner; - _variationAccessor = variationAccessor; + _variationContextAccessor = variationContextAccessor; _id = _inner.Id; _key = _inner.Key; @@ -480,7 +480,7 @@ namespace umbraco { // handle context culture if (culture == null) - culture = _variationAccessor.CurrentVariation.Culture; + culture = _variationContextAccessor.VariationContext.Culture; // no invariant culture infos if (culture == "") return null;