diff --git a/src/Umbraco.Core/Composing/Current.cs b/src/Umbraco.Core/Composing/Current.cs
deleted file mode 100644
index 532a3fe676..0000000000
--- a/src/Umbraco.Core/Composing/Current.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-using System;
-using Umbraco.Core.Configuration;
-using Umbraco.Core.IO;
-
-namespace Umbraco.Core.Composing
-{
- ///
- /// Provides a static service locator for most singletons.
- ///
- ///
- /// This class is initialized with the container in UmbracoApplicationBase,
- /// right after the container is created in UmbracoApplicationBase.HandleApplicationStart.
- /// Obviously, this is a service locator, which some may consider an anti-pattern. And yet,
- /// practically, it works.
- ///
- public static class Current
- {
- private static IFactory _factory;
-
- ///
- /// Gets or sets the factory.
- ///
- public static IFactory Factory
- {
- get
- {
- if (_factory == null) throw new InvalidOperationException("No factory has been set.");
- return _factory;
- }
- set
- {
- if (_factory != null) throw new InvalidOperationException("A factory has already been set.");
- _factory = value;
- }
- }
-
- public static bool HasFactory => _factory != null;
-
- ///
- /// Resets . Indented for testing only, and not supported in production code.
- ///
- ///
- /// For UNIT TESTS exclusively.
- /// Resets everything that is 'current'.
- ///
- public static void Reset()
- {
- _factory.DisposeIfDisposable();
- _factory = null;
-
- Resetted?.Invoke(null, EventArgs.Empty);
- }
-
- internal static event EventHandler Resetted;
-
- public static IIOHelper IOHelper
- => Factory.GetInstance();
-
- }
-}
diff --git a/src/Umbraco.Core/Runtime/CoreRuntime.cs b/src/Umbraco.Core/Runtime/CoreRuntime.cs
index 6dbb41093c..077ce2b760 100644
--- a/src/Umbraco.Core/Runtime/CoreRuntime.cs
+++ b/src/Umbraco.Core/Runtime/CoreRuntime.cs
@@ -202,7 +202,7 @@ namespace Umbraco.Core.Runtime
composers.Compose();
// create the factory
- _factory = Current.Factory = composition.CreateFactory();
+ _factory = composition.CreateFactory();
// create & initialize the components
_components = _factory.GetInstance();
@@ -229,7 +229,7 @@ namespace Umbraco.Core.Runtime
{
try
{
- _factory = Current.Factory = composition?.CreateFactory();
+ _factory = composition?.CreateFactory();
}
catch { /* yea */ }
}
diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj
index 333b837e2e..ed3726a74c 100755
--- a/src/Umbraco.Core/Umbraco.Core.csproj
+++ b/src/Umbraco.Core/Umbraco.Core.csproj
@@ -129,7 +129,6 @@
-
@@ -152,7 +151,6 @@
-
Properties\SolutionInfo.cs
diff --git a/src/Umbraco.Infrastructure/PropertyEditors/DataEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/DataEditor.cs
index 8ccb1680cc..afdcd65ad1 100644
--- a/src/Umbraco.Infrastructure/PropertyEditors/DataEditor.cs
+++ b/src/Umbraco.Infrastructure/PropertyEditors/DataEditor.cs
@@ -22,9 +22,6 @@ namespace Umbraco.Core.PropertyEditors
[DataContract]
public class DataEditor : IDataEditor
{
- private readonly IDataTypeService _dataTypeService;
- private readonly ILocalizationService _localizationService;
- private readonly ILocalizedTextService _localizedTextService;
private IDictionary _defaultConfiguration;
private IDataValueEditor _dataValueEditor;
@@ -33,11 +30,12 @@ namespace Umbraco.Core.PropertyEditors
///
public DataEditor(ILogger logger, IDataTypeService dataTypeService, ILocalizationService localizationService, ILocalizedTextService localizedTextService, IShortStringHelper shortStringHelper, EditorType type = EditorType.PropertyValue)
{
- _dataTypeService = dataTypeService;
- _localizationService = localizationService;
- _localizedTextService = localizedTextService;
- ShortStringHelper = shortStringHelper ?? throw new ArgumentNullException(nameof(shortStringHelper));
Logger = logger ?? throw new ArgumentNullException(nameof(logger));
+ DataTypeService = dataTypeService ?? throw new ArgumentNullException(nameof(dataTypeService));
+ LocalizationService = localizationService ?? throw new ArgumentNullException(nameof(localizationService));
+ LocalizedTextService = localizedTextService ?? throw new ArgumentNullException(nameof(localizedTextService));
+ ShortStringHelper = shortStringHelper ?? throw new ArgumentNullException(nameof(shortStringHelper));
+
// defaults
Type = type;
@@ -62,6 +60,9 @@ namespace Umbraco.Core.PropertyEditors
protected DataEditorAttribute Attribute { get; }
protected IShortStringHelper ShortStringHelper { get; }
+ protected ILocalizedTextService LocalizedTextService { get; }
+ protected ILocalizationService LocalizationService { get; }
+ protected IDataTypeService DataTypeService { get; }
///
/// Gets a logger.
@@ -179,7 +180,7 @@ namespace Umbraco.Core.PropertyEditors
if (Attribute == null)
throw new InvalidOperationException($"The editor is not attributed with {nameof(DataEditorAttribute)}");
- return new DataValueEditor(_dataTypeService, _localizationService, _localizedTextService, ShortStringHelper, Attribute);
+ return new DataValueEditor(DataTypeService, LocalizationService, LocalizedTextService, ShortStringHelper, Attribute);
}
///
diff --git a/src/Umbraco.Infrastructure/PropertyEditors/LabelPropertyEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/LabelPropertyEditor.cs
index ef4a24d53e..f91c8efdd1 100644
--- a/src/Umbraco.Infrastructure/PropertyEditors/LabelPropertyEditor.cs
+++ b/src/Umbraco.Infrastructure/PropertyEditors/LabelPropertyEditor.cs
@@ -18,10 +18,7 @@ namespace Umbraco.Core.PropertyEditors
public class LabelPropertyEditor : DataEditor
{
private readonly IIOHelper _ioHelper;
- private readonly IDataTypeService _dataTypeService;
- private readonly ILocalizedTextService _localizedTextService;
- private readonly ILocalizationService _localizationService;
- private readonly IShortStringHelper _shortStringHelper;
+
///
/// Initializes a new instance of the class.
@@ -30,14 +27,10 @@ namespace Umbraco.Core.PropertyEditors
: base(logger, dataTypeService, localizationService, localizedTextService, shortStringHelper)
{
_ioHelper = ioHelper;
- _dataTypeService = dataTypeService;
- _localizedTextService = localizedTextService;
- _localizationService = localizationService;
- _shortStringHelper = shortStringHelper;
}
///
- protected override IDataValueEditor CreateValueEditor() => new LabelPropertyValueEditor(_dataTypeService, _localizationService,_localizedTextService, _shortStringHelper, Attribute);
+ protected override IDataValueEditor CreateValueEditor() => new LabelPropertyValueEditor(DataTypeService, LocalizationService,LocalizedTextService, ShortStringHelper, Attribute);
///
protected override IConfigurationEditor CreateConfigurationEditor() => new LabelConfigurationEditor(_ioHelper);
diff --git a/src/Umbraco.ModelsBuilder.Embedded/Configuration/ModelsBuilderConfig.cs b/src/Umbraco.ModelsBuilder.Embedded/Configuration/ModelsBuilderConfig.cs
index 4fb46facaf..698f00c94a 100644
--- a/src/Umbraco.ModelsBuilder.Embedded/Configuration/ModelsBuilderConfig.cs
+++ b/src/Umbraco.ModelsBuilder.Embedded/Configuration/ModelsBuilderConfig.cs
@@ -78,7 +78,7 @@ namespace Umbraco.ModelsBuilder.Embedded.Configuration
value = ConfigurationManager.AppSettings[prefix + "ModelsDirectory"];
if (!string.IsNullOrWhiteSpace(value))
{
- var root = Current.IOHelper.MapPath("~/");
+ var root = _ioHelper.MapPath("~/");
if (root == null)
throw new ConfigurationErrorsException("Could not determine root directory.");
diff --git a/src/Umbraco.ModelsBuilder.Embedded/LiveModelsProviderModule.cs b/src/Umbraco.ModelsBuilder.Embedded/LiveModelsProviderModule.cs
index 678ff241b0..a04723a05e 100644
--- a/src/Umbraco.ModelsBuilder.Embedded/LiveModelsProviderModule.cs
+++ b/src/Umbraco.ModelsBuilder.Embedded/LiveModelsProviderModule.cs
@@ -1,7 +1,7 @@
using System;
using System.Web;
using Umbraco.Core;
-using Umbraco.Core.Composing;
+using Umbraco.Web.Composing;
using Umbraco.ModelsBuilder.Embedded;
// will install only if configuration says it needs to be installed
diff --git a/src/Umbraco.Tests/Cache/DistributedCache/DistributedCacheTests.cs b/src/Umbraco.Tests/Cache/DistributedCache/DistributedCacheTests.cs
index 225bc54eb9..6043e7b0d6 100644
--- a/src/Umbraco.Tests/Cache/DistributedCache/DistributedCacheTests.cs
+++ b/src/Umbraco.Tests/Cache/DistributedCache/DistributedCacheTests.cs
@@ -1,15 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using Moq;
using NUnit.Framework;
-using Umbraco.Core;
using Umbraco.Core.Cache;
-using Umbraco.Core.Composing;
-using Umbraco.Core.Logging;
+using Umbraco.Web.Composing;
using Umbraco.Core.Sync;
-using Umbraco.Tests.Components;
-using Umbraco.Tests.TestHelpers;
namespace Umbraco.Tests.Cache.DistributedCache
{
diff --git a/src/Umbraco.Tests/Composing/ComposingTestBase.cs b/src/Umbraco.Tests/Composing/ComposingTestBase.cs
index 7b80324686..ac7dd8be2a 100644
--- a/src/Umbraco.Tests/Composing/ComposingTestBase.cs
+++ b/src/Umbraco.Tests/Composing/ComposingTestBase.cs
@@ -5,10 +5,9 @@ using Moq;
using NUnit.Framework;
using Umbraco.Core.Cache;
using Umbraco.Core.Composing;
-using Umbraco.Core.Configuration;
-using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Tests.TestHelpers;
+using Current = Umbraco.Web.Composing.Current;
namespace Umbraco.Tests.Composing
{
diff --git a/src/Umbraco.Tests/Composing/LazyCollectionBuilderTests.cs b/src/Umbraco.Tests/Composing/LazyCollectionBuilderTests.cs
index 86d1104b84..4d0135d6c4 100644
--- a/src/Umbraco.Tests/Composing/LazyCollectionBuilderTests.cs
+++ b/src/Umbraco.Tests/Composing/LazyCollectionBuilderTests.cs
@@ -6,10 +6,10 @@ using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Core.Cache;
using Umbraco.Core.Composing;
-using Umbraco.Core.Configuration;
using Umbraco.Core.Logging;
using Umbraco.Tests.Components;
using Umbraco.Tests.TestHelpers;
+using Current = Umbraco.Web.Composing.Current;
namespace Umbraco.Tests.Composing
{
diff --git a/src/Umbraco.Tests/IO/FileSystemsTests.cs b/src/Umbraco.Tests/IO/FileSystemsTests.cs
index 48ac93c2cf..8b8b71304a 100644
--- a/src/Umbraco.Tests/IO/FileSystemsTests.cs
+++ b/src/Umbraco.Tests/IO/FileSystemsTests.cs
@@ -5,8 +5,8 @@ using Moq;
using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Core.Cache;
-using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.Composing;
+using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.IO;
using Umbraco.Core.IO.MediaPathSchemes;
using Umbraco.Core.Logging;
@@ -14,6 +14,7 @@ using Umbraco.Core.Services;
using Umbraco.Tests.Components;
using Umbraco.Tests.TestHelpers;
using Umbraco.Core.Composing.CompositionExtensions;
+using Current = Umbraco.Web.Composing.Current;
using FileSystems = Umbraco.Core.IO.FileSystems;
namespace Umbraco.Tests.IO
diff --git a/src/Umbraco.Tests/Models/MediaXmlTest.cs b/src/Umbraco.Tests/Models/MediaXmlTest.cs
index f312744db6..793ba97827 100644
--- a/src/Umbraco.Tests/Models/MediaXmlTest.cs
+++ b/src/Umbraco.Tests/Models/MediaXmlTest.cs
@@ -36,7 +36,7 @@ namespace Umbraco.Tests.Models
var localizationService = Mock.Of();
var mediaFileSystem = new MediaFileSystem(Mock.Of(), scheme, logger, ShortStringHelper);
- var ignored = new FileUploadPropertyEditor(Mock.Of(), mediaFileSystem, config, dataTypeService, localizationService, ShortStringHelper);
+ var ignored = new FileUploadPropertyEditor(Mock.Of(), mediaFileSystem, config, DataTypeService, LocalizationService, LocalizedTextService, ShortStringHelper);
var media = MockedMedia.CreateMediaImage(mediaType, -1);
media.WriterId = -1; // else it's zero and that's not a user and it breaks the tests
diff --git a/src/Umbraco.Tests/Models/VariationTests.cs b/src/Umbraco.Tests/Models/VariationTests.cs
index e07658ea1c..d322926783 100644
--- a/src/Umbraco.Tests/Models/VariationTests.cs
+++ b/src/Umbraco.Tests/Models/VariationTests.cs
@@ -1,23 +1,23 @@
using System;
using Moq;
using NUnit.Framework;
-using NUnit.Framework.Internal;
using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
using Umbraco.Core.Models;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Services;
-using Umbraco.Core.Services.Implement;
using Umbraco.Core.Strings;
using Umbraco.Tests.TestHelpers;
using ILogger = Umbraco.Core.Logging.ILogger;
+using Current = Umbraco.Web.Composing.Current;
namespace Umbraco.Tests.Models
{
[TestFixture]
public class VariationTests
{
+ private IFactory _factory;
private IShortStringHelper ShortStringHelper { get; } = TestHelper.ShortStringHelper;
[SetUp]
@@ -37,8 +37,7 @@ namespace Umbraco.Tests.Models
configs.Add(SettingsForTests.GetDefaultGlobalSettings);
configs.Add(SettingsForTests.GetDefaultUmbracoSettings);
- var factory = Mock.Of();
- Current.Factory = factory;
+ _factory = Mock.Of();
var dataTypeService = Mock.Of();
var localizationService = Mock.Of();
@@ -62,7 +61,7 @@ namespace Umbraco.Tests.Models
dataTypeService: dataTypeService,
localizedTextService: Mock.Of());
- Mock.Get(factory)
+ Mock.Get(_factory)
.Setup(x => x.GetInstance(It.IsAny()))
.Returns(x =>
{
@@ -449,7 +448,7 @@ namespace Umbraco.Tests.Models
[Test]
public void ContentPublishValuesWithMixedPropertyTypeVariations()
{
- var propertyValidationService = new PropertyValidationService(Current.Factory.GetInstance(), Current.Factory.GetInstance().DataTypeService);
+ var propertyValidationService = new PropertyValidationService(_factory.GetInstance(), _factory.GetInstance().DataTypeService);
const string langFr = "fr-FR";
// content type varies by Culture
@@ -581,7 +580,7 @@ namespace Umbraco.Tests.Models
prop.SetValue("a");
Assert.AreEqual("a", prop.GetValue());
Assert.IsNull(prop.GetValue(published: true));
- var propertyValidationService = new PropertyValidationService(Current.Factory.GetInstance(), Current.Factory.GetInstance().DataTypeService);
+ var propertyValidationService = new PropertyValidationService(_factory.GetInstance(), _factory.GetInstance().DataTypeService);
Assert.IsTrue(propertyValidationService.IsPropertyValid(prop));
diff --git a/src/Umbraco.Tests/Packaging/CreatedPackagesRepositoryTests.cs b/src/Umbraco.Tests/Packaging/CreatedPackagesRepositoryTests.cs
index d7a99aedfd..013e2e5c5f 100644
--- a/src/Umbraco.Tests/Packaging/CreatedPackagesRepositoryTests.cs
+++ b/src/Umbraco.Tests/Packaging/CreatedPackagesRepositoryTests.cs
@@ -150,8 +150,8 @@ namespace Umbraco.Tests.Packaging
{
var file1 = $"~/{_testBaseFolder}/App_Plugins/MyPlugin/package.manifest";
var file2 = $"~/{_testBaseFolder}/App_Plugins/MyPlugin/styles.css";
- var mappedFile1 = Current.IOHelper.MapPath(file1);
- var mappedFile2 = Current.IOHelper.MapPath(file2);
+ var mappedFile1 = IOHelper.MapPath(file1);
+ var mappedFile2 = IOHelper.MapPath(file2);
Directory.CreateDirectory(Path.GetDirectoryName(mappedFile1));
Directory.CreateDirectory(Path.GetDirectoryName(mappedFile2));
File.WriteAllText(mappedFile1, "hello world");
@@ -175,7 +175,7 @@ namespace Umbraco.Tests.Packaging
def = PackageBuilder.GetById(def.Id); //re-get
Assert.IsNotNull(def.PackagePath);
- using (var archive = ZipFile.OpenRead(Current.IOHelper.MapPath(zip)))
+ using (var archive = ZipFile.OpenRead(IOHelper.MapPath(zip)))
{
Assert.AreEqual(3, archive.Entries.Count);
diff --git a/src/Umbraco.Tests/Persistence/Repositories/DataTypeDefinitionRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/DataTypeDefinitionRepositoryTest.cs
index 069d93f409..e1c79b9d26 100644
--- a/src/Umbraco.Tests/Persistence/Repositories/DataTypeDefinitionRepositoryTest.cs
+++ b/src/Umbraco.Tests/Persistence/Repositories/DataTypeDefinitionRepositoryTest.cs
@@ -36,9 +36,9 @@ namespace Umbraco.Tests.Persistence.Repositories
using (provider.CreateScope())
{
var dtRepo = CreateRepository();
- IDataType dataType1 = new DataType(new RadioButtonsPropertyEditor(Logger, ServiceContext.TextService, IOHelper, ShortStringHelper)) { Name = "dt1" };
+ IDataType dataType1 = new DataType(new RadioButtonsPropertyEditor(Logger, IOHelper, DataTypeService, LocalizationService, LocalizedTextService, ShortStringHelper)) { Name = "dt1" };
dtRepo.Save(dataType1);
- IDataType dataType2 = new DataType(new RadioButtonsPropertyEditor(Logger, ServiceContext.TextService, IOHelper, ShortStringHelper)) { Name = "dt2" };
+ IDataType dataType2 = new DataType(new RadioButtonsPropertyEditor(Logger, IOHelper, DataTypeService, LocalizationService, LocalizedTextService, ShortStringHelper)) { Name = "dt2" };
dtRepo.Save(dataType2);
var ctRepo = Factory.GetInstance();
@@ -106,14 +106,14 @@ namespace Umbraco.Tests.Persistence.Repositories
var container2 = new EntityContainer(Constants.ObjectTypes.DataType) { Name = "blah2", ParentId = container1.Id };
containerRepository.Save(container2);
- var dataType = (IDataType) new DataType(new RadioButtonsPropertyEditor(Logger, ServiceContext.TextService, IOHelper, ShortStringHelper), container2.Id)
+ var dataType = (IDataType) new DataType(new RadioButtonsPropertyEditor(Logger, IOHelper, DataTypeService, LocalizationService, LocalizedTextService, ShortStringHelper), container2.Id)
{
Name = "dt1"
};
repository.Save(dataType);
//create a
- var dataType2 = (IDataType)new DataType(new RadioButtonsPropertyEditor(Logger, ServiceContext.TextService, IOHelper, ShortStringHelper), dataType.Id)
+ var dataType2 = (IDataType)new DataType(new RadioButtonsPropertyEditor(Logger, IOHelper, DataTypeService, LocalizationService, LocalizedTextService, ShortStringHelper), dataType.Id)
{
Name = "dt2"
};
@@ -185,7 +185,7 @@ namespace Umbraco.Tests.Persistence.Repositories
var container = new EntityContainer(Constants.ObjectTypes.DataType) { Name = "blah" };
containerRepository.Save(container);
- var dataTypeDefinition = new DataType(new RadioButtonsPropertyEditor(Logger, ServiceContext.TextService, IOHelper, ShortStringHelper), container.Id) { Name = "test" };
+ var dataTypeDefinition = new DataType(new RadioButtonsPropertyEditor(Logger, IOHelper, DataTypeService, LocalizationService, LocalizedTextService, ShortStringHelper), container.Id) { Name = "test" };
repository.Save(dataTypeDefinition);
Assert.AreEqual(container.Id, dataTypeDefinition.ParentId);
@@ -205,7 +205,7 @@ namespace Umbraco.Tests.Persistence.Repositories
var container = new EntityContainer(Constants.ObjectTypes.DataType) { Name = "blah" };
containerRepository.Save(container);
- IDataType dataType = new DataType(new RadioButtonsPropertyEditor(Logger, ServiceContext.TextService, IOHelper, ShortStringHelper), container.Id) { Name = "test" };
+ IDataType dataType = new DataType(new RadioButtonsPropertyEditor(Logger, IOHelper, DataTypeService, LocalizationService, LocalizedTextService, ShortStringHelper), container.Id) { Name = "test" };
repository.Save(dataType);
// Act
@@ -228,7 +228,7 @@ namespace Umbraco.Tests.Persistence.Repositories
using (provider.CreateScope())
{
var repository = CreateRepository();
- IDataType dataType = new DataType(new RadioButtonsPropertyEditor(Logger, ServiceContext.TextService, IOHelper, ShortStringHelper)) {Name = "test"};
+ IDataType dataType = new DataType(new RadioButtonsPropertyEditor(Logger, IOHelper, DataTypeService, LocalizationService, LocalizedTextService, ShortStringHelper)) {Name = "test"};
repository.Save(dataType);
diff --git a/src/Umbraco.Tests/Persistence/Repositories/DocumentRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/DocumentRepositoryTest.cs
index 17a01b128a..fc45f0ba3f 100644
--- a/src/Umbraco.Tests/Persistence/Repositories/DocumentRepositoryTest.cs
+++ b/src/Umbraco.Tests/Persistence/Repositories/DocumentRepositoryTest.cs
@@ -359,7 +359,7 @@ namespace Umbraco.Tests.Persistence.Repositories
{
var repository = CreateRepository((IScopeAccessor)provider, out var contentTypeRepository, out DataTypeRepository dataTypeDefinitionRepository);
- var editor = new DecimalPropertyEditor(Logger, ShortStringHelper);
+ var editor = new DecimalPropertyEditor(Logger, DataTypeService, LocalizationService, LocalizedTextService, ShortStringHelper);
var dtd = new DataType(editor) { Name = "test", DatabaseType = ValueStorageType.Decimal };
dataTypeDefinitionRepository.Save(dtd);
diff --git a/src/Umbraco.Tests/PropertyEditors/ImageCropperTest.cs b/src/Umbraco.Tests/PropertyEditors/ImageCropperTest.cs
index ad4e77d81b..294938f691 100644
--- a/src/Umbraco.Tests/PropertyEditors/ImageCropperTest.cs
+++ b/src/Umbraco.Tests/PropertyEditors/ImageCropperTest.cs
@@ -7,7 +7,6 @@ using Newtonsoft.Json.Linq;
using Umbraco.Core;
using Umbraco.Core.Cache;
using Umbraco.Core.Composing;
-using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
@@ -22,6 +21,7 @@ using Umbraco.Tests.TestHelpers;
using Umbraco.Web.Models;
using Umbraco.Web;
using Umbraco.Web.PropertyEditors;
+using Current = Umbraco.Web.Composing.Current;
namespace Umbraco.Tests.PropertyEditors
{
diff --git a/src/Umbraco.Tests/PropertyEditors/PropertyEditorValueEditorTests.cs b/src/Umbraco.Tests/PropertyEditors/PropertyEditorValueEditorTests.cs
index 134a1e3711..a24b4cbafd 100644
--- a/src/Umbraco.Tests/PropertyEditors/PropertyEditorValueEditorTests.cs
+++ b/src/Umbraco.Tests/PropertyEditors/PropertyEditorValueEditorTests.cs
@@ -8,10 +8,10 @@ using Umbraco.Core.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.PropertyEditors;
-using Umbraco.Core.Services;
using Umbraco.Core.Strings;
using Umbraco.Tests.Components;
using Umbraco.Tests.TestHelpers;
+using Current = Umbraco.Web.Composing.Current;
namespace Umbraco.Tests.PropertyEditors
{
diff --git a/src/Umbraco.Tests/Published/NestedContentTests.cs b/src/Umbraco.Tests/Published/NestedContentTests.cs
index f3e5b500af..1b79b65b19 100644
--- a/src/Umbraco.Tests/Published/NestedContentTests.cs
+++ b/src/Umbraco.Tests/Published/NestedContentTests.cs
@@ -5,8 +5,7 @@ using System.Linq;
using Moq;
using NUnit.Framework;
using Umbraco.Core;
-using Umbraco.Core.Composing;
-using Umbraco.Core.Exceptions;
+using Umbraco.Web.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;
@@ -15,7 +14,6 @@ using Umbraco.Core.Services;
using Umbraco.Tests.PublishedContent;
using Umbraco.Tests.TestHelpers;
using Umbraco.Web;
-using Umbraco.Web.Models;
using Umbraco.Web.PropertyEditors;
using Umbraco.Web.PropertyEditors.ValueConverters;
using Umbraco.Web.PublishedCache;
diff --git a/src/Umbraco.Tests/PublishedContent/NuCacheChildrenTests.cs b/src/Umbraco.Tests/PublishedContent/NuCacheChildrenTests.cs
index dac3fab96b..6fe8b69778 100644
--- a/src/Umbraco.Tests/PublishedContent/NuCacheChildrenTests.cs
+++ b/src/Umbraco.Tests/PublishedContent/NuCacheChildrenTests.cs
@@ -27,6 +27,7 @@ using Umbraco.Web.Cache;
using Umbraco.Web.PublishedCache;
using Umbraco.Web.PublishedCache.NuCache;
using Umbraco.Web.PublishedCache.NuCache.DataSource;
+using Current = Umbraco.Web.Composing.Current;
namespace Umbraco.Tests.PublishedContent
{
@@ -129,7 +130,7 @@ namespace Umbraco.Tests.PublishedContent
// create a published content type factory
var contentTypeFactory = new PublishedContentTypeFactory(
- Mock.Of(),
+ PublishedModelFactory,
new PropertyValueConverterCollection(Array.Empty()),
dataTypeService);
@@ -161,7 +162,7 @@ namespace Umbraco.Tests.PublishedContent
_source,
globalSettings,
Mock.Of(),
- Mock.Of(),
+ PublishedModelFactory,
new UrlSegmentProviderCollection(new[] { new DefaultUrlSegmentProvider(TestHelper.ShortStringHelper) }),
typeFinder,
hostingEnvironment,
diff --git a/src/Umbraco.Tests/PublishedContent/NuCacheTests.cs b/src/Umbraco.Tests/PublishedContent/NuCacheTests.cs
index 4beddbb036..c77f8528cf 100644
--- a/src/Umbraco.Tests/PublishedContent/NuCacheTests.cs
+++ b/src/Umbraco.Tests/PublishedContent/NuCacheTests.cs
@@ -26,6 +26,7 @@ using Umbraco.Web.Cache;
using Umbraco.Web.PublishedCache;
using Umbraco.Web.PublishedCache.NuCache;
using Umbraco.Web.PublishedCache.NuCache.DataSource;
+using Current = Umbraco.Web.Composing.Current;
namespace Umbraco.Tests.PublishedContent
{
@@ -175,7 +176,7 @@ namespace Umbraco.Tests.PublishedContent
// create a published content type factory
var contentTypeFactory = new PublishedContentTypeFactory(
- Mock.Of(),
+ publishedModelFactory,
new PropertyValueConverterCollection(Array.Empty()),
dataTypeService);
@@ -203,7 +204,7 @@ namespace Umbraco.Tests.PublishedContent
dataSource,
globalSettings,
Mock.Of(),
- Mock.Of(),
+ publishedModelFactory,
new UrlSegmentProviderCollection(new[] { new DefaultUrlSegmentProvider(TestHelper.ShortStringHelper) }),
typeFinder,
TestHelper.GetHostingEnvironment(),
diff --git a/src/Umbraco.Tests/Routing/MediaUrlProviderTests.cs b/src/Umbraco.Tests/Routing/MediaUrlProviderTests.cs
index e2ce265ae3..e5bb48da33 100644
--- a/src/Umbraco.Tests/Routing/MediaUrlProviderTests.cs
+++ b/src/Umbraco.Tests/Routing/MediaUrlProviderTests.cs
@@ -37,7 +37,7 @@ namespace Umbraco.Tests.Routing
var propertyEditors = new PropertyEditorCollection(new DataEditorCollection(new IDataEditor[]
{
- new FileUploadPropertyEditor(logger, mediaFileSystemMock, contentSection, dataTypeService, LocalizationService, ShortStringHelper),
+ new FileUploadPropertyEditor(logger, mediaFileSystemMock, contentSection, dataTypeService, LocalizationService, LocalizedTextService, ShortStringHelper),
new ImageCropperPropertyEditor(logger, mediaFileSystemMock, contentSection, dataTypeService, LocalizationService, IOHelper, ShortStringHelper, LocalizedTextService),
}));
_mediaUrlProvider = new DefaultMediaUrlProvider(propertyEditors);
diff --git a/src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs b/src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs
index 7bf520b0cf..e7b86b9a4b 100644
--- a/src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs
+++ b/src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs
@@ -50,7 +50,8 @@ namespace Umbraco.Tests.Routing
TestObjects.GetGlobalSettings(),
ShortStringHelper,
new SurfaceControllerTypeCollection(Enumerable.Empty()),
- new UmbracoApiControllerTypeCollection(Enumerable.Empty()));
+ new UmbracoApiControllerTypeCollection(Enumerable.Empty()),
+ IOHelper);
}
public class TestRuntime : WebRuntime
diff --git a/src/Umbraco.Tests/Runtimes/CoreRuntimeTests.cs b/src/Umbraco.Tests/Runtimes/CoreRuntimeTests.cs
index 64716754b0..c7a9d4b04f 100644
--- a/src/Umbraco.Tests/Runtimes/CoreRuntimeTests.cs
+++ b/src/Umbraco.Tests/Runtimes/CoreRuntimeTests.cs
@@ -4,10 +4,8 @@ using System.Data;
using System.Web.Hosting;
using Examine;
using Moq;
-using NPoco.Expressions;
using NUnit.Framework;
using Umbraco.Core;
-using Umbraco.Core.Compose;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.UmbracoSettings;
@@ -24,6 +22,7 @@ using Umbraco.Tests.TestHelpers.Stubs;
using Umbraco.Web;
using Umbraco.Web.Hosting;
using Umbraco.Web.Runtime;
+using Current = Umbraco.Web.Composing.Current;
namespace Umbraco.Tests.Runtimes
{
diff --git a/src/Umbraco.Tests/Runtimes/StandaloneTests.cs b/src/Umbraco.Tests/Runtimes/StandaloneTests.cs
index 2b8559741d..6dd9f1e3a3 100644
--- a/src/Umbraco.Tests/Runtimes/StandaloneTests.cs
+++ b/src/Umbraco.Tests/Runtimes/StandaloneTests.cs
@@ -35,6 +35,7 @@ using Umbraco.Web.PublishedCache;
using Umbraco.Web.Routing;
using Umbraco.Web.Runtime;
using File = System.IO.File;
+using Current = Umbraco.Web.Composing.Current;
namespace Umbraco.Tests.Runtimes
{
@@ -48,7 +49,7 @@ namespace Umbraco.Tests.Runtimes
IFactory factory = null;
// clear
- foreach (var file in Directory.GetFiles(Path.Combine(Current.IOHelper.MapPath("~/App_Data")), "NuCache.*"))
+ foreach (var file in Directory.GetFiles(Path.Combine(TestHelper.IOHelper.MapPath("~/App_Data")), "NuCache.*"))
File.Delete(file);
// settings
diff --git a/src/Umbraco.Tests/Scoping/ScopeEventDispatcherTests.cs b/src/Umbraco.Tests/Scoping/ScopeEventDispatcherTests.cs
index 56d8e320e1..7b60a9fae2 100644
--- a/src/Umbraco.Tests/Scoping/ScopeEventDispatcherTests.cs
+++ b/src/Umbraco.Tests/Scoping/ScopeEventDispatcherTests.cs
@@ -4,6 +4,7 @@ using Moq;
using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Core.Cache;
+using Umbraco.Core.Composing;
using Umbraco.Core.Events;
using Umbraco.Core.Models;
using Umbraco.Core.IO;
@@ -11,10 +12,10 @@ using Umbraco.Core.Logging;
using Umbraco.Core.Scoping;
using Umbraco.Tests.TestHelpers;
using Umbraco.Tests.TestHelpers.Entities;
-using Umbraco.Core.Composing;
using Umbraco.Core.Persistence.Mappers;
using Umbraco.Core.Services;
using Umbraco.Tests.Components;
+using Current = Umbraco.Web.Composing.Current;
namespace Umbraco.Tests.Scoping
{
diff --git a/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs b/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs
index 4fa9601257..3ecc16b8a9 100644
--- a/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs
+++ b/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs
@@ -102,7 +102,7 @@ namespace Umbraco.Tests.Scoping
new DatabaseDataSource(),
Factory.GetInstance(),
Factory.GetInstance(),
- Mock.Of(),
+ new NoopPublishedModelFactory(),
new UrlSegmentProviderCollection(new[] { new DefaultUrlSegmentProvider(ShortStringHelper) }),
typeFinder,
hostingEnvironment,
diff --git a/src/Umbraco.Tests/TestHelpers/BaseUsingSqlCeSyntax.cs b/src/Umbraco.Tests/TestHelpers/BaseUsingSqlCeSyntax.cs
index f5f9fbc96f..2bd36947c6 100644
--- a/src/Umbraco.Tests/TestHelpers/BaseUsingSqlCeSyntax.cs
+++ b/src/Umbraco.Tests/TestHelpers/BaseUsingSqlCeSyntax.cs
@@ -5,14 +5,13 @@ using NPoco;
using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Core.Cache;
+using Umbraco.Core.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.Persistence.Mappers;
using Umbraco.Core.Persistence.SqlSyntax;
-using Umbraco.Core.Composing;
-using Umbraco.Core.Configuration;
-using Umbraco.Core.IO;
using Umbraco.Core.Persistence;
using Umbraco.Tests.Components;
+using Current = Umbraco.Web.Composing.Current;
namespace Umbraco.Tests.TestHelpers
{
diff --git a/src/Umbraco.Tests/TestHelpers/Stubs/TestControllerFactory.cs b/src/Umbraco.Tests/TestHelpers/Stubs/TestControllerFactory.cs
index 273f7a996e..c79a0f5c47 100644
--- a/src/Umbraco.Tests/TestHelpers/Stubs/TestControllerFactory.cs
+++ b/src/Umbraco.Tests/TestHelpers/Stubs/TestControllerFactory.cs
@@ -7,9 +7,10 @@ using System.Web.Routing;
using System.Web.SessionState;
using Moq;
using Umbraco.Core;
-using Umbraco.Core.Logging;
using Umbraco.Core.Composing;
+using Umbraco.Core.Logging;
using Umbraco.Web;
+using Current = Umbraco.Web.Composing.Current;
namespace Umbraco.Tests.TestHelpers.Stubs
{
diff --git a/src/Umbraco.Tests/Testing/UmbracoTestBase.cs b/src/Umbraco.Tests/Testing/UmbracoTestBase.cs
index 0ea43742da..014959cd1f 100644
--- a/src/Umbraco.Tests/Testing/UmbracoTestBase.cs
+++ b/src/Umbraco.Tests/Testing/UmbracoTestBase.cs
@@ -38,23 +38,22 @@ using Umbraco.Web.Actions;
using Umbraco.Web.ContentApps;
using Umbraco.Web.PublishedCache;
using Umbraco.Web.Routing;
-using Umbraco.Web.Trees;
using Umbraco.Core.Composing.CompositionExtensions;
using Umbraco.Core.Hosting;
using Umbraco.Core.Mapping;
using Umbraco.Core.Serialization;
using Umbraco.Web.Composing.CompositionExtensions;
+using Umbraco.Web.Composing;
using Umbraco.Web.Hosting;
using Umbraco.Web.Sections;
-using Current = Umbraco.Core.Composing.Current;
using FileSystems = Umbraco.Core.IO.FileSystems;
using Umbraco.Web.Templates;
using Umbraco.Web.PropertyEditors;
using Umbraco.Core.Dictionary;
-using Umbraco.Core.Persistence.Repositories;
using Umbraco.Core.Security;
using Umbraco.Core.Services;
using Umbraco.Net;
+using Current = Umbraco.Web.Composing.Current;
namespace Umbraco.Tests.Testing
{
diff --git a/src/Umbraco.Tests/Web/Controllers/ContentControllerTests.cs b/src/Umbraco.Tests/Web/Controllers/ContentControllerTests.cs
index e8f1c1f986..d514f27345 100644
--- a/src/Umbraco.Tests/Web/Controllers/ContentControllerTests.cs
+++ b/src/Umbraco.Tests/Web/Controllers/ContentControllerTests.cs
@@ -12,18 +12,15 @@ using Newtonsoft.Json.Linq;
using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Core.Cache;
-using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
using Umbraco.Core.Dictionary;
using Umbraco.Core.Logging;
-using Umbraco.Web.Composing;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Entities;
using Umbraco.Core.Models.Membership;
using Umbraco.Core.Persistence;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Services;
-using Umbraco.Core.Strings;
using Umbraco.Tests.TestHelpers;
using Umbraco.Tests.TestHelpers.ControllerTesting;
using Umbraco.Tests.TestHelpers.Entities;
@@ -35,6 +32,7 @@ using Umbraco.Web.Models.ContentEditing;
using Umbraco.Web.PropertyEditors;
using Umbraco.Web.Trees;
using Umbraco.Web.WebApi;
+using Umbraco.Web.Composing;
using Task = System.Threading.Tasks.Task;
namespace Umbraco.Tests.Web.Controllers
diff --git a/src/Umbraco.Tests/Web/Controllers/PluginControllerAreaTests.cs b/src/Umbraco.Tests/Web/Controllers/PluginControllerAreaTests.cs
index ed0c02b806..b0665bbfc1 100644
--- a/src/Umbraco.Tests/Web/Controllers/PluginControllerAreaTests.cs
+++ b/src/Umbraco.Tests/Web/Controllers/PluginControllerAreaTests.cs
@@ -14,7 +14,7 @@ namespace Umbraco.Tests.Web.Controllers
public void Ensure_Same_Area1()
{
Assert.Throws(() =>
- new PluginControllerArea(TestObjects.GetGlobalSettings(),
+ new PluginControllerArea(TestObjects.GetGlobalSettings(), IOHelper,
new PluginControllerMetadata[]
{
PluginController.GetMetadata(typeof(Plugin1Controller)),
@@ -27,7 +27,7 @@ namespace Umbraco.Tests.Web.Controllers
public void Ensure_Same_Area3()
{
Assert.Throws(() =>
- new PluginControllerArea(TestObjects.GetGlobalSettings(),
+ new PluginControllerArea(TestObjects.GetGlobalSettings(), IOHelper,
new PluginControllerMetadata[]
{
PluginController.GetMetadata(typeof(Plugin1Controller)),
@@ -39,7 +39,7 @@ namespace Umbraco.Tests.Web.Controllers
[Test]
public void Ensure_Same_Area2()
{
- var area = new PluginControllerArea(TestObjects.GetGlobalSettings(),
+ var area = new PluginControllerArea(TestObjects.GetGlobalSettings(), IOHelper,
new PluginControllerMetadata[]
{
PluginController.GetMetadata(typeof(Plugin1Controller)),
diff --git a/src/Umbraco.Tests/Web/Mvc/RenderIndexActionSelectorAttributeTests.cs b/src/Umbraco.Tests/Web/Mvc/RenderIndexActionSelectorAttributeTests.cs
index 89a2e789d3..2daa8e9a98 100644
--- a/src/Umbraco.Tests/Web/Mvc/RenderIndexActionSelectorAttributeTests.cs
+++ b/src/Umbraco.Tests/Web/Mvc/RenderIndexActionSelectorAttributeTests.cs
@@ -33,7 +33,7 @@ namespace Umbraco.Tests.Web.Mvc
public void SetUp()
{
Current.UmbracoContextAccessor = new TestUmbracoContextAccessor();
- Core.Composing.Current.Factory = Mock.Of();
+ Current.Factory = Mock.Of();
}
[TearDown]
diff --git a/src/Umbraco.Tests/Web/UmbracoHelperTests.cs b/src/Umbraco.Tests/Web/UmbracoHelperTests.cs
index 826b62e599..ccb42e478a 100644
--- a/src/Umbraco.Tests/Web/UmbracoHelperTests.cs
+++ b/src/Umbraco.Tests/Web/UmbracoHelperTests.cs
@@ -1,19 +1,15 @@
using System;
using System.IO;
using System.Text;
-using Examine.LuceneEngine;
-using Lucene.Net.Analysis;
-using Lucene.Net.Analysis.Standard;
using Moq;
using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Core.Cache;
using Umbraco.Core.Composing;
-using Umbraco.Core.Configuration;
-using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Tests.TestHelpers;
using Umbraco.Web;
+using Current = Umbraco.Web.Composing.Current;
namespace Umbraco.Tests.Web
{
diff --git a/src/Umbraco.Web/BatchedDatabaseServerMessenger.cs b/src/Umbraco.Web/BatchedDatabaseServerMessenger.cs
index 228e3144b2..5662883d2a 100644
--- a/src/Umbraco.Web/BatchedDatabaseServerMessenger.cs
+++ b/src/Umbraco.Web/BatchedDatabaseServerMessenger.cs
@@ -30,8 +30,8 @@ namespace Umbraco.Web
private readonly IUmbracoDatabaseFactory _databaseFactory;
public BatchedDatabaseServerMessenger(
- IRuntimeState runtime, IUmbracoDatabaseFactory databaseFactory, IScopeProvider scopeProvider, ISqlContext sqlContext, IProfilingLogger proflog, DatabaseServerMessengerOptions options, IHostingEnvironment hostingEnvironment)
- : base(runtime, scopeProvider, sqlContext, proflog, true, options, hostingEnvironment, Current.CacheRefreshers)
+ IRuntimeState runtime, IUmbracoDatabaseFactory databaseFactory, IScopeProvider scopeProvider, ISqlContext sqlContext, IProfilingLogger proflog, DatabaseServerMessengerOptions options, IHostingEnvironment hostingEnvironment, CacheRefresherCollection cacheRefreshers)
+ : base(runtime, scopeProvider, sqlContext, proflog, true, options, hostingEnvironment, cacheRefreshers)
{
_databaseFactory = databaseFactory;
}
diff --git a/src/Umbraco.Web/Composing/Current.cs b/src/Umbraco.Web/Composing/Current.cs
index 6a208d88bc..6e952d08a5 100644
--- a/src/Umbraco.Web/Composing/Current.cs
+++ b/src/Umbraco.Web/Composing/Current.cs
@@ -29,8 +29,6 @@ using Umbraco.Web.Routing;
using Umbraco.Web.Services;
using Umbraco.Web.WebApi;
-using CoreCurrent = Umbraco.Core.Composing.Current;
-
namespace Umbraco.Web.Composing
{
// see notes in Umbraco.Core.Composing.Current.
@@ -38,11 +36,30 @@ namespace Umbraco.Web.Composing
{
private static readonly object Locker = new object();
+ private static IFactory _factory;
+
+ ///
+ /// Gets or sets the factory.
+ ///
+ public static IFactory Factory
+ {
+ get
+ {
+ if (_factory == null) throw new InvalidOperationException("No factory has been set.");
+ return _factory;
+ }
+ set
+ {
+ if (_factory != null) throw new InvalidOperationException("A factory has already been set.");
+ _factory = value;
+ }
+ }
+
private static IUmbracoContextAccessor _umbracoContextAccessor;
static Current()
{
- CoreCurrent.Resetted += (sender, args) =>
+ Resetted += (sender, args) =>
{
if (_umbracoContextAccessor != null)
{
@@ -53,17 +70,23 @@ namespace Umbraco.Web.Composing
};
}
- // for UNIT TESTS exclusively!
- internal static void Reset()
+ ///
+ /// for UNIT TESTS exclusively! Resets . Indented for testing only, and not supported in production code.
+ ///
+ ///
+ /// For UNIT TESTS exclusively.
+ /// Resets everything that is 'current'.
+ ///
+ public static void Reset()
{
- CoreCurrent.Reset();
+ _factory.DisposeIfDisposable();
+ _factory = null;
+
+ Resetted?.Invoke(null, EventArgs.Empty);
}
- ///
- /// Gets the factory.
- ///
- public static IFactory Factory
- => CoreCurrent.Factory;
+ internal static event EventHandler Resetted;
+
#region Temp & Special
diff --git a/src/Umbraco.Web/ContentApps/ContentAppFactoryCollectionBuilder.cs b/src/Umbraco.Web/ContentApps/ContentAppFactoryCollectionBuilder.cs
index 0561cc06f0..06273c5fd9 100644
--- a/src/Umbraco.Web/ContentApps/ContentAppFactoryCollectionBuilder.cs
+++ b/src/Umbraco.Web/ContentApps/ContentAppFactoryCollectionBuilder.cs
@@ -2,10 +2,10 @@
using System.Linq;
using Umbraco.Core;
using Umbraco.Core.Composing;
-using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Manifest;
using Umbraco.Core.Models.ContentEditing;
+using Current = Umbraco.Web.Composing.Current;
namespace Umbraco.Web.ContentApps
{
diff --git a/src/Umbraco.Web/Editors/ContentTypeController.cs b/src/Umbraco.Web/Editors/ContentTypeController.cs
index e64485e5ab..b9bde906ea 100644
--- a/src/Umbraco.Web/Editors/ContentTypeController.cs
+++ b/src/Umbraco.Web/Editors/ContentTypeController.cs
@@ -11,7 +11,7 @@ using System.Xml;
using System.Xml.Linq;
using Umbraco.Core;
using Umbraco.Core.Cache;
-using Umbraco.Core.Composing;
+using Umbraco.Web.Composing;
using Umbraco.Core.Configuration;
using Umbraco.Core.Dictionary;
using Umbraco.Core.Logging;
diff --git a/src/Umbraco.Web/Editors/PackageController.cs b/src/Umbraco.Web/Editors/PackageController.cs
index d3ef290a72..a01b5fa248 100644
--- a/src/Umbraco.Web/Editors/PackageController.cs
+++ b/src/Umbraco.Web/Editors/PackageController.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
@@ -9,10 +8,8 @@ using System.Text;
using System.Web;
using System.Web.Http;
using Semver;
-using Umbraco.Core.Composing;
-using Umbraco.Core.IO;
+using Umbraco.Web.Composing;
using Umbraco.Core.Models.Packaging;
-using Umbraco.Web.Models.ContentEditing;
using Umbraco.Web.Mvc;
using Umbraco.Web.WebApi;
using Umbraco.Web.WebApi.Filters;
diff --git a/src/Umbraco.Web/Editors/PackageInstallController.cs b/src/Umbraco.Web/Editors/PackageInstallController.cs
index 8b62b23688..5851d64eba 100644
--- a/src/Umbraco.Web/Editors/PackageInstallController.cs
+++ b/src/Umbraco.Web/Editors/PackageInstallController.cs
@@ -8,7 +8,7 @@ using System.Web.Http;
using Semver;
using Umbraco.Core;
using Umbraco.Core.Cache;
-using Umbraco.Core.Composing;
+using Umbraco.Web.Composing;
using Umbraco.Core.Configuration;
using Umbraco.Core.Logging;
using Umbraco.Core.Models.Editors;
@@ -43,7 +43,7 @@ namespace Umbraco.Web.Editors
: base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper)
{
_umbracoVersion = umbracoVersion;
-
+
}
///
diff --git a/src/Umbraco.Web/Editors/TemplateQueryController.cs b/src/Umbraco.Web/Editors/TemplateQueryController.cs
index 8148d24887..09bf8e23d4 100644
--- a/src/Umbraco.Web/Editors/TemplateQueryController.cs
+++ b/src/Umbraco.Web/Editors/TemplateQueryController.cs
@@ -10,6 +10,7 @@ using Umbraco.Core.Logging;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.Persistence;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Web.Models.TemplateQuery;
using Umbraco.Web.Mvc;
using Umbraco.Web.WebApi;
@@ -34,8 +35,9 @@ namespace Umbraco.Web.Editors
IProfilingLogger logger,
IRuntimeState runtimeState,
UmbracoHelper umbracoHelper,
- IVariationContextAccessor variationContextAccessor)
- : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
+ IVariationContextAccessor variationContextAccessor,
+ IShortStringHelper shortStringHelper)
+ : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper)
{
_variationContextAccessor = variationContextAccessor;
}
diff --git a/src/Umbraco.Web/HealthCheck/Checks/Config/AbstractConfigCheck.cs b/src/Umbraco.Web/HealthCheck/Checks/Config/AbstractConfigCheck.cs
index bac4fb4c47..41f0434360 100644
--- a/src/Umbraco.Web/HealthCheck/Checks/Config/AbstractConfigCheck.cs
+++ b/src/Umbraco.Web/HealthCheck/Checks/Config/AbstractConfigCheck.cs
@@ -2,8 +2,8 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
-using Umbraco.Core.Composing;
using Umbraco.Core.IO;
+using Umbraco.Web.Composing;
using Umbraco.Core.Services;
namespace Umbraco.Web.HealthCheck.Checks.Config
@@ -13,6 +13,7 @@ namespace Umbraco.Web.HealthCheck.Checks.Config
private readonly ConfigurationService _configurationService;
protected ILocalizedTextService TextService { get; }
+ protected IIOHelper IOHelper { get; }
///
/// Gets the config file path.
@@ -52,9 +53,10 @@ namespace Umbraco.Web.HealthCheck.Checks.Config
get { return false; }
}
- protected AbstractConfigCheck(ILocalizedTextService textService)
+ protected AbstractConfigCheck(ILocalizedTextService textService, IIOHelper ioHelper)
{
TextService = textService;
+ IOHelper = ioHelper;
_configurationService = new ConfigurationService(AbsoluteFilePath, XPath, textService);
}
@@ -66,7 +68,7 @@ namespace Umbraco.Web.HealthCheck.Checks.Config
///
/// Gets the absolute file path.
///
- private string AbsoluteFilePath => Current.IOHelper.MapPath(FilePath);
+ private string AbsoluteFilePath => IOHelper.MapPath(FilePath);
///
/// Gets the message for when the check has succeeded.
diff --git a/src/Umbraco.Web/HealthCheck/Checks/Config/CompilationDebugCheck.cs b/src/Umbraco.Web/HealthCheck/Checks/Config/CompilationDebugCheck.cs
index 951609f91f..47c7adc694 100644
--- a/src/Umbraco.Web/HealthCheck/Checks/Config/CompilationDebugCheck.cs
+++ b/src/Umbraco.Web/HealthCheck/Checks/Config/CompilationDebugCheck.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using Umbraco.Core.IO;
using Umbraco.Core.Services;
namespace Umbraco.Web.HealthCheck.Checks.Config
@@ -8,8 +9,8 @@ namespace Umbraco.Web.HealthCheck.Checks.Config
Group = "Live Environment")]
public class CompilationDebugCheck : AbstractConfigCheck
{
- public CompilationDebugCheck(ILocalizedTextService textService)
- : base(textService)
+ public CompilationDebugCheck(ILocalizedTextService textService, IIOHelper ioHelper)
+ : base(textService, ioHelper)
{ }
public override string FilePath => "~/Web.config";
diff --git a/src/Umbraco.Web/HealthCheck/Checks/Config/CustomErrorsCheck.cs b/src/Umbraco.Web/HealthCheck/Checks/Config/CustomErrorsCheck.cs
index 63986b6c62..0a34390ed2 100644
--- a/src/Umbraco.Web/HealthCheck/Checks/Config/CustomErrorsCheck.cs
+++ b/src/Umbraco.Web/HealthCheck/Checks/Config/CustomErrorsCheck.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Web.Configuration;
+using Umbraco.Core.IO;
using Umbraco.Core.Services;
namespace Umbraco.Web.HealthCheck.Checks.Config
@@ -10,8 +11,8 @@ namespace Umbraco.Web.HealthCheck.Checks.Config
Group = "Live Environment")]
public class CustomErrorsCheck : AbstractConfigCheck
{
- public CustomErrorsCheck(ILocalizedTextService textService)
- : base(textService)
+ public CustomErrorsCheck(ILocalizedTextService textService, IIOHelper ioHelper)
+ : base(textService, ioHelper)
{ }
public override string FilePath => "~/Web.config";
diff --git a/src/Umbraco.Web/HealthCheck/Checks/Config/MacroErrorsCheck.cs b/src/Umbraco.Web/HealthCheck/Checks/Config/MacroErrorsCheck.cs
index 09c041998e..d23a12fdd3 100644
--- a/src/Umbraco.Web/HealthCheck/Checks/Config/MacroErrorsCheck.cs
+++ b/src/Umbraco.Web/HealthCheck/Checks/Config/MacroErrorsCheck.cs
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
+using Umbraco.Core.IO;
using Umbraco.Core.Services;
namespace Umbraco.Web.HealthCheck.Checks.Config
@@ -9,8 +10,8 @@ namespace Umbraco.Web.HealthCheck.Checks.Config
Group = "Configuration")]
public class MacroErrorsCheck : AbstractConfigCheck
{
- public MacroErrorsCheck(ILocalizedTextService textService)
- : base(textService)
+ public MacroErrorsCheck(ILocalizedTextService textService, IIOHelper ioHelper)
+ : base(textService, ioHelper)
{ }
public override string FilePath => "~/Config/umbracoSettings.config";
diff --git a/src/Umbraco.Web/HealthCheck/Checks/Config/NotificationEmailCheck.cs b/src/Umbraco.Web/HealthCheck/Checks/Config/NotificationEmailCheck.cs
index 8c52a5686b..3630597573 100644
--- a/src/Umbraco.Web/HealthCheck/Checks/Config/NotificationEmailCheck.cs
+++ b/src/Umbraco.Web/HealthCheck/Checks/Config/NotificationEmailCheck.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using Umbraco.Core.IO;
using Umbraco.Core.Services;
namespace Umbraco.Web.HealthCheck.Checks.Config
@@ -10,8 +11,8 @@ namespace Umbraco.Web.HealthCheck.Checks.Config
{
private const string DefaultFromEmail = "your@email.here";
- public NotificationEmailCheck(ILocalizedTextService textService)
- : base(textService)
+ public NotificationEmailCheck(ILocalizedTextService textService, IIOHelper ioHelper)
+ : base(textService, ioHelper)
{ }
public override string FilePath => "~/Config/umbracoSettings.config";
diff --git a/src/Umbraco.Web/HealthCheck/Checks/Config/TraceCheck.cs b/src/Umbraco.Web/HealthCheck/Checks/Config/TraceCheck.cs
index b8e4e51eb9..24c9577c29 100644
--- a/src/Umbraco.Web/HealthCheck/Checks/Config/TraceCheck.cs
+++ b/src/Umbraco.Web/HealthCheck/Checks/Config/TraceCheck.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using Umbraco.Core.IO;
using Umbraco.Core.Services;
namespace Umbraco.Web.HealthCheck.Checks.Config
@@ -9,8 +10,8 @@ namespace Umbraco.Web.HealthCheck.Checks.Config
public class TraceCheck : AbstractConfigCheck
{
- public TraceCheck(ILocalizedTextService textService)
- : base(textService)
+ public TraceCheck(ILocalizedTextService textService, IIOHelper ioHelper)
+ : base(textService, ioHelper)
{ }
public override string FilePath => "~/Web.config";
diff --git a/src/Umbraco.Web/HealthCheck/Checks/Config/TrySkipIisCustomErrorsCheck.cs b/src/Umbraco.Web/HealthCheck/Checks/Config/TrySkipIisCustomErrorsCheck.cs
index 4a467d7120..6cfbf18370 100644
--- a/src/Umbraco.Web/HealthCheck/Checks/Config/TrySkipIisCustomErrorsCheck.cs
+++ b/src/Umbraco.Web/HealthCheck/Checks/Config/TrySkipIisCustomErrorsCheck.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Web;
+using Umbraco.Core.IO;
using Umbraco.Core.Services;
namespace Umbraco.Web.HealthCheck.Checks.Config
@@ -13,8 +14,8 @@ namespace Umbraco.Web.HealthCheck.Checks.Config
{
private readonly Version _serverVersion = HttpRuntime.IISVersion;
- public TrySkipIisCustomErrorsCheck(ILocalizedTextService textService)
- : base(textService)
+ public TrySkipIisCustomErrorsCheck(ILocalizedTextService textService, IIOHelper ioHelper)
+ : base(textService, ioHelper)
{ }
public override string FilePath => "~/Config/umbracoSettings.config";
diff --git a/src/Umbraco.Web/HealthCheck/Checks/Security/BaseHttpHeaderCheck.cs b/src/Umbraco.Web/HealthCheck/Checks/Security/BaseHttpHeaderCheck.cs
index 13d95dfe04..6c61f0d1c8 100644
--- a/src/Umbraco.Web/HealthCheck/Checks/Security/BaseHttpHeaderCheck.cs
+++ b/src/Umbraco.Web/HealthCheck/Checks/Security/BaseHttpHeaderCheck.cs
@@ -7,8 +7,7 @@ using System.Text.RegularExpressions;
using System.Xml.Linq;
using System.Xml.XPath;
using Umbraco.Core;
-using Umbraco.Core.Composing;
-using Umbraco.Core.IO;
+using Umbraco.Web.Composing;
using Umbraco.Core.Services;
namespace Umbraco.Web.HealthCheck.Checks.Security
diff --git a/src/Umbraco.Web/HealthCheck/Checks/Security/HttpsCheck.cs b/src/Umbraco.Web/HealthCheck/Checks/Security/HttpsCheck.cs
index eec51eacf0..1571d93de6 100644
--- a/src/Umbraco.Web/HealthCheck/Checks/Security/HttpsCheck.cs
+++ b/src/Umbraco.Web/HealthCheck/Checks/Security/HttpsCheck.cs
@@ -2,11 +2,9 @@
using System.Collections.Generic;
using System.Net;
using System.Security.Cryptography.X509Certificates;
-using System.Web;
using Umbraco.Core;
-using Umbraco.Core.Composing;
+using Umbraco.Web.Composing;
using Umbraco.Core.Configuration;
-using Umbraco.Core.IO;
using Umbraco.Core.Services;
using Umbraco.Web.HealthCheck.Checks.Config;
diff --git a/src/Umbraco.Web/HealthCheck/NotificationMethods/EmailNotificationMethod.cs b/src/Umbraco.Web/HealthCheck/NotificationMethods/EmailNotificationMethod.cs
index 3152059d44..ec7ed98828 100644
--- a/src/Umbraco.Web/HealthCheck/NotificationMethods/EmailNotificationMethod.cs
+++ b/src/Umbraco.Web/HealthCheck/NotificationMethods/EmailNotificationMethod.cs
@@ -5,6 +5,7 @@ using System.Threading.Tasks;
using Umbraco.Core;
using Umbraco.Web.Composing;
using Umbraco.Core.Configuration;
+using Umbraco.Core.Configuration.HealthChecks;
using Umbraco.Core.Logging;
using Umbraco.Core.Services;
@@ -18,7 +19,7 @@ namespace Umbraco.Web.HealthCheck.NotificationMethods
private readonly ILogger _logger;
private readonly IGlobalSettings _globalSettings;
- public EmailNotificationMethod(ILocalizedTextService textService, IRuntimeState runtimeState, ILogger logger, IGlobalSettings globalSettings)
+ public EmailNotificationMethod(ILocalizedTextService textService, IRuntimeState runtimeState, ILogger logger, IGlobalSettings globalSettings, IHealthChecks healthChecks): base(healthChecks)
{
var recipientEmail = Settings["recipientEmail"]?.Value;
if (string.IsNullOrWhiteSpace(recipientEmail))
diff --git a/src/Umbraco.Web/HealthCheck/NotificationMethods/NotificationMethodBase.cs b/src/Umbraco.Web/HealthCheck/NotificationMethods/NotificationMethodBase.cs
index 7836aa3079..14f65b2aea 100644
--- a/src/Umbraco.Web/HealthCheck/NotificationMethods/NotificationMethodBase.cs
+++ b/src/Umbraco.Web/HealthCheck/NotificationMethods/NotificationMethodBase.cs
@@ -10,7 +10,7 @@ namespace Umbraco.Web.HealthCheck.NotificationMethods
{
public abstract class NotificationMethodBase : IHealthCheckNotificationMethod
{
- protected NotificationMethodBase()
+ protected NotificationMethodBase(IHealthChecks healthCheckConfig)
{
var type = GetType();
var attribute = type.GetCustomAttribute();
@@ -20,7 +20,6 @@ namespace Umbraco.Web.HealthCheck.NotificationMethods
return;
}
- var healthCheckConfig = Current.Configs.HealthChecks();
var notificationMethods = healthCheckConfig.NotificationSettings.NotificationMethods;
var notificationMethod = notificationMethods[attribute.Alias];
if (notificationMethod == null)
diff --git a/src/Umbraco.Web/Install/InstallStatusTracker.cs b/src/Umbraco.Web/Install/InstallStatusTracker.cs
index 6a9482ad6d..58e8507ec8 100644
--- a/src/Umbraco.Web/Install/InstallStatusTracker.cs
+++ b/src/Umbraco.Web/Install/InstallStatusTracker.cs
@@ -1,16 +1,11 @@
using System;
-using System.Collections.Concurrent;
using System.Collections.Generic;
-using System.Globalization;
using System.IO;
using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using Newtonsoft.Json;
using Umbraco.Core;
using Umbraco.Core.Collections;
-using Umbraco.Core.Composing;
-using Umbraco.Core.IO;
+using Umbraco.Web.Composing;
using Umbraco.Web.Install.Models;
namespace Umbraco.Web.Install
diff --git a/src/Umbraco.Web/Install/InstallSteps/ConfigureMachineKey.cs b/src/Umbraco.Web/Install/InstallSteps/ConfigureMachineKey.cs
index 7ea8f088fe..c249993585 100644
--- a/src/Umbraco.Web/Install/InstallSteps/ConfigureMachineKey.cs
+++ b/src/Umbraco.Web/Install/InstallSteps/ConfigureMachineKey.cs
@@ -2,8 +2,7 @@
using System.Threading.Tasks;
using System.Web.Configuration;
using System.Xml.Linq;
-using Umbraco.Core.Composing;
-using Umbraco.Core.IO;
+using Umbraco.Web.Composing;
using Umbraco.Core.Security;
using Umbraco.Web.Install.Models;
diff --git a/src/Umbraco.Web/Install/InstallSteps/StarterKitCleanupStep.cs b/src/Umbraco.Web/Install/InstallSteps/StarterKitCleanupStep.cs
index f56db4c91c..4b8970c167 100644
--- a/src/Umbraco.Web/Install/InstallSteps/StarterKitCleanupStep.cs
+++ b/src/Umbraco.Web/Install/InstallSteps/StarterKitCleanupStep.cs
@@ -3,8 +3,7 @@ using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
-using Umbraco.Core.Composing;
-using Umbraco.Core.IO;
+using Umbraco.Web.Composing;
using Umbraco.Web.Install.Models;
namespace Umbraco.Web.Install.InstallSteps
diff --git a/src/Umbraco.Web/JavaScript/ClientDependencyConfiguration.cs b/src/Umbraco.Web/JavaScript/ClientDependencyConfiguration.cs
index 6a2e0b16cb..19391cbd30 100644
--- a/src/Umbraco.Web/JavaScript/ClientDependencyConfiguration.cs
+++ b/src/Umbraco.Web/JavaScript/ClientDependencyConfiguration.cs
@@ -9,8 +9,7 @@ using System.Xml.Linq;
using ClientDependency.Core.CompositeFiles.Providers;
using ClientDependency.Core.Config;
using Semver;
-using Umbraco.Core.Composing;
-using Umbraco.Core.IO;
+using Umbraco.Web.Composing;
using Umbraco.Core.Logging;
namespace Umbraco.Web.JavaScript
diff --git a/src/Umbraco.Web/Macros/MacroRenderer.cs b/src/Umbraco.Web/Macros/MacroRenderer.cs
index 7a4f55371e..1b5f907205 100755
--- a/src/Umbraco.Web/Macros/MacroRenderer.cs
+++ b/src/Umbraco.Web/Macros/MacroRenderer.cs
@@ -6,10 +6,9 @@ using System.Linq;
using System.Text;
using Umbraco.Core;
using Umbraco.Core.Cache;
-using Umbraco.Core.Composing;
+using Umbraco.Web.Composing;
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.Events;
-using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Macros;
using Umbraco.Core.Models;
diff --git a/src/Umbraco.Web/Mvc/AreaRegistrationExtensions.cs b/src/Umbraco.Web/Mvc/AreaRegistrationExtensions.cs
index 56a2182598..7a3a3fbcf4 100644
--- a/src/Umbraco.Web/Mvc/AreaRegistrationExtensions.cs
+++ b/src/Umbraco.Web/Mvc/AreaRegistrationExtensions.cs
@@ -7,6 +7,7 @@ using System.Web.SessionState;
using Umbraco.Core;
using Umbraco.Core.Configuration;
using Umbraco.Core.Exceptions;
+using Umbraco.Core.IO;
using Umbraco.Web.Composing;
using Umbraco.Web.WebApi;
@@ -42,6 +43,7 @@ namespace Umbraco.Web.Mvc
///
internal static Route RouteControllerPlugin(this AreaRegistration area,
IGlobalSettings globalSettings,
+ IIOHelper ioHelper,
string controllerName, Type controllerType, RouteCollection routes,
string controllerSuffixName, string defaultAction, object defaultId,
string umbracoTokenValue = "backoffice",
@@ -57,7 +59,7 @@ namespace Umbraco.Web.Mvc
if (routes == null) throw new ArgumentNullException(nameof(routes));
if (defaultId == null) throw new ArgumentNullException(nameof(defaultId));
- var umbracoArea = globalSettings.GetUmbracoMvcArea(Current.IOHelper);
+ var umbracoArea = globalSettings.GetUmbracoMvcArea(ioHelper);
//routes are explicitly named with controller names and IDs
var url = umbracoArea + "/" +
diff --git a/src/Umbraco.Web/Mvc/BackOfficeArea.cs b/src/Umbraco.Web/Mvc/BackOfficeArea.cs
index 5f257a9860..b4425a3239 100644
--- a/src/Umbraco.Web/Mvc/BackOfficeArea.cs
+++ b/src/Umbraco.Web/Mvc/BackOfficeArea.cs
@@ -1,6 +1,7 @@
using System.Web.Mvc;
-using Umbraco.Core.Composing;
+using Umbraco.Web.Composing;
using Umbraco.Core.Configuration;
+using Umbraco.Core.IO;
using Umbraco.Web.Editors;
namespace Umbraco.Web.Mvc
@@ -11,10 +12,12 @@ namespace Umbraco.Web.Mvc
internal class BackOfficeArea : AreaRegistration
{
private readonly IGlobalSettings _globalSettings;
+ private readonly IIOHelper _ioHelper;
- public BackOfficeArea(IGlobalSettings globalSettings)
+ public BackOfficeArea(IGlobalSettings globalSettings, IIOHelper ioHelper)
{
_globalSettings = globalSettings;
+ _ioHelper = ioHelper;
}
///
@@ -48,6 +51,6 @@ namespace Umbraco.Web.Mvc
new[] {typeof (BackOfficeController).Namespace});
}
- public override string AreaName => _globalSettings.GetUmbracoMvcArea(Current.IOHelper);
+ public override string AreaName => _globalSettings.GetUmbracoMvcArea(_ioHelper);
}
}
diff --git a/src/Umbraco.Web/Mvc/ContainerControllerFactory.cs b/src/Umbraco.Web/Mvc/ContainerControllerFactory.cs
index cb732fdbb9..914e4bbb70 100644
--- a/src/Umbraco.Web/Mvc/ContainerControllerFactory.cs
+++ b/src/Umbraco.Web/Mvc/ContainerControllerFactory.cs
@@ -7,18 +7,18 @@ namespace Umbraco.Web.Mvc
{
public class ContainerControllerFactory : DefaultControllerFactory
{
- private readonly IFactory _container;
+ private readonly Lazy _factory;
- public ContainerControllerFactory(IFactory container)
+ public ContainerControllerFactory(Lazy factory)
{
- _container = container;
+ _factory = factory;
}
protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType)
{
try
{
- return (IController) _container.GetInstance(controllerType);
+ return (IController) _factory.Value.GetInstance(controllerType);
}
catch (Exception e)
{
@@ -28,7 +28,7 @@ namespace Umbraco.Web.Mvc
public override void ReleaseController(IController controller)
{
- _container.Release(controller);
+ _factory.Value.Release(controller);
}
}
}
diff --git a/src/Umbraco.Web/Mvc/EnsurePublishedContentRequestAttribute.cs b/src/Umbraco.Web/Mvc/EnsurePublishedContentRequestAttribute.cs
index 168da455e3..187c64d93a 100644
--- a/src/Umbraco.Web/Mvc/EnsurePublishedContentRequestAttribute.cs
+++ b/src/Umbraco.Web/Mvc/EnsurePublishedContentRequestAttribute.cs
@@ -72,7 +72,7 @@ namespace Umbraco.Web.Mvc
protected UmbracoContext UmbracoContext => _umbracoContextAccessor?.UmbracoContext ?? Current.UmbracoContext;
// TODO: try lazy property injection?
- private IPublishedRouter PublishedRouter => Core.Composing.Current.Factory.GetInstance();
+ private IPublishedRouter PublishedRouter => Current.Factory.GetInstance();
///
/// Exposes an UmbracoHelper
diff --git a/src/Umbraco.Web/Mvc/MasterControllerFactory.cs b/src/Umbraco.Web/Mvc/MasterControllerFactory.cs
index 6d2f1ce501..026a9dee5f 100644
--- a/src/Umbraco.Web/Mvc/MasterControllerFactory.cs
+++ b/src/Umbraco.Web/Mvc/MasterControllerFactory.cs
@@ -2,6 +2,8 @@
using System.Linq;
using System.Web.Mvc;
using System.Web.Routing;
+using CSharpTest.Net.Interfaces;
+using Umbraco.Core.Composing;
using Umbraco.Web.Composing;
namespace Umbraco.Web.Mvc
@@ -22,7 +24,7 @@ namespace Umbraco.Web.Mvc
///
/// The factories accessor.
public MasterControllerFactory(Func factoriesAccessor)
- : base(Current.Factory)
+ : base(new Lazy(() => Current.Factory))
{
// note
// because the MasterControllerFactory needs to be ctored to be assigned to
diff --git a/src/Umbraco.Web/Mvc/PluginController.cs b/src/Umbraco.Web/Mvc/PluginController.cs
index 2336bb56d1..9e080ee042 100644
--- a/src/Umbraco.Web/Mvc/PluginController.cs
+++ b/src/Umbraco.Web/Mvc/PluginController.cs
@@ -3,12 +3,13 @@ using System.Collections.Concurrent;
using System.Web.Mvc;
using Umbraco.Core;
using Umbraco.Core.Cache;
+using Umbraco.Core.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.Persistence;
-using Umbraco.Core.Composing;
using Umbraco.Core.Services;
using Umbraco.Web.Security;
using Umbraco.Web.WebApi;
+using Current = Umbraco.Web.Composing.Current;
namespace Umbraco.Web.Mvc
{
@@ -22,7 +23,7 @@ namespace Umbraco.Web.Mvc
// for debugging purposes
internal Guid InstanceId { get; } = Guid.NewGuid();
-
+
///
/// Gets the Umbraco context.
///
diff --git a/src/Umbraco.Web/Mvc/PluginControllerArea.cs b/src/Umbraco.Web/Mvc/PluginControllerArea.cs
index 5a1365bfa1..713b0c6551 100644
--- a/src/Umbraco.Web/Mvc/PluginControllerArea.cs
+++ b/src/Umbraco.Web/Mvc/PluginControllerArea.cs
@@ -6,6 +6,7 @@ using System.Web.Routing;
using Umbraco.Core;
using Umbraco.Core.Configuration;
using Umbraco.Core.Composing;
+using Umbraco.Core.IO;
using Umbraco.Web.WebApi;
namespace Umbraco.Web.Mvc
@@ -16,6 +17,7 @@ namespace Umbraco.Web.Mvc
internal class PluginControllerArea : AreaRegistration
{
private readonly IGlobalSettings _globalSettings;
+ private readonly IIOHelper _ioHelper;
private readonly IEnumerable _surfaceControllers;
private readonly IEnumerable _apiControllers;
private readonly string _areaName;
@@ -26,9 +28,10 @@ namespace Umbraco.Web.Mvc
///
///
///
- public PluginControllerArea(IGlobalSettings globalSettings, IEnumerable pluginControllers)
+ public PluginControllerArea(IGlobalSettings globalSettings, IIOHelper ioHelper, IEnumerable pluginControllers)
{
_globalSettings = globalSettings;
+ _ioHelper = ioHelper;
var controllers = pluginControllers.ToArray();
if (controllers.Any(x => x.AreaName.IsNullOrWhiteSpace()))
@@ -67,14 +70,14 @@ namespace Umbraco.Web.Mvc
///
///
/// The routes will be:
- ///
+ ///
/// /Umbraco/[AreaName]/[ControllerName]/[Action]/[Id]
///
private void MapRouteSurfaceControllers(RouteCollection routes, IEnumerable surfaceControllers)
{
foreach (var s in surfaceControllers)
{
- var route = this.RouteControllerPlugin(_globalSettings, s.ControllerName, s.ControllerType, routes, "", "Index", UrlParameter.Optional, "surface");
+ var route = this.RouteControllerPlugin(_globalSettings, _ioHelper, s.ControllerName, s.ControllerType, routes, "", "Index", UrlParameter.Optional, "surface");
//set the route handler to our SurfaceRouteHandler
route.RouteHandler = new SurfaceRouteHandler();
}
@@ -89,7 +92,7 @@ namespace Umbraco.Web.Mvc
{
foreach (var s in apiControllers)
{
- this.RouteControllerPlugin(_globalSettings, s.ControllerName, s.ControllerType, routes, "", "", UrlParameter.Optional, "api",
+ this.RouteControllerPlugin(_globalSettings, _ioHelper, s.ControllerName, s.ControllerType, routes, "", "", UrlParameter.Optional, "api",
isMvc: false,
areaPathPrefix: s.IsBackOffice ? "backoffice" : null);
}
diff --git a/src/Umbraco.Web/Mvc/PluginViewEngine.cs b/src/Umbraco.Web/Mvc/PluginViewEngine.cs
index fcdddbfbf1..259210431c 100644
--- a/src/Umbraco.Web/Mvc/PluginViewEngine.cs
+++ b/src/Umbraco.Web/Mvc/PluginViewEngine.cs
@@ -1,9 +1,7 @@
using System.IO;
using System.Linq;
using System.Web.Mvc;
-using Lucene.Net.Util;
-using Umbraco.Core.Composing;
-using Umbraco.Core.IO;
+using Umbraco.Web.Composing;
namespace Umbraco.Web.Mvc
{
diff --git a/src/Umbraco.Web/Mvc/UmbracoController.cs b/src/Umbraco.Web/Mvc/UmbracoController.cs
index c9155c421b..6841bf5875 100644
--- a/src/Umbraco.Web/Mvc/UmbracoController.cs
+++ b/src/Umbraco.Web/Mvc/UmbracoController.cs
@@ -3,7 +3,7 @@ using System.Web;
using System.Web.Mvc;
using Microsoft.Owin;
using Umbraco.Core.Cache;
-using Umbraco.Core.Composing;
+using Umbraco.Web.Composing;
using Umbraco.Core.Configuration;
using Umbraco.Core.Logging;
using Umbraco.Core;
diff --git a/src/Umbraco.Web/Mvc/UmbracoControllerFactory.cs b/src/Umbraco.Web/Mvc/UmbracoControllerFactory.cs
index 1c041d417c..325f18d957 100644
--- a/src/Umbraco.Web/Mvc/UmbracoControllerFactory.cs
+++ b/src/Umbraco.Web/Mvc/UmbracoControllerFactory.cs
@@ -3,6 +3,7 @@ using System.Web.Mvc;
using System.Web.Routing;
using System.Web.SessionState;
using Umbraco.Core;
+using Umbraco.Core.Composing;
using Umbraco.Web.Composing;
namespace Umbraco.Web.Mvc
@@ -68,7 +69,7 @@ namespace Umbraco.Web.Mvc
internal class OverridenDefaultControllerFactory : ContainerControllerFactory
{
public OverridenDefaultControllerFactory()
- : base(Current.Factory)
+ : base(new Lazy(() => Current.Factory))
{ }
public new IController GetControllerInstance(RequestContext requestContext, Type controllerType)
diff --git a/src/Umbraco.Web/Mvc/UmbracoVirtualNodeRouteHandler.cs b/src/Umbraco.Web/Mvc/UmbracoVirtualNodeRouteHandler.cs
index 6f5dcab45f..8fc8b255a8 100644
--- a/src/Umbraco.Web/Mvc/UmbracoVirtualNodeRouteHandler.cs
+++ b/src/Umbraco.Web/Mvc/UmbracoVirtualNodeRouteHandler.cs
@@ -5,7 +5,7 @@ using Umbraco.Core.Models.PublishedContent;
using Umbraco.Web.Models;
using Umbraco.Web.Routing;
using Umbraco.Core;
-using Umbraco.Core.Composing;
+using Umbraco.Web.Composing;
namespace Umbraco.Web.Mvc
{
diff --git a/src/Umbraco.Web/PropertyEditors/ContentPickerPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/ContentPickerPropertyEditor.cs
index f5f0abe183..77c74b288c 100644
--- a/src/Umbraco.Web/PropertyEditors/ContentPickerPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/ContentPickerPropertyEditor.cs
@@ -24,18 +24,21 @@ namespace Umbraco.Web.PropertyEditors
{
private readonly IDataTypeService _dataTypeService;
private readonly ILocalizationService _localizationService;
+ private readonly ILocalizedTextService _localizedTextService;
private readonly IIOHelper _ioHelper;
public ContentPickerPropertyEditor(
IDataTypeService dataTypeService,
ILocalizationService localizationService,
+ ILocalizedTextService localizedTextService,
ILogger logger,
IIOHelper ioHelper,
IShortStringHelper shortStringHelper)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService,Current.Services.TextService, shortStringHelper)
+ : base(logger, dataTypeService,localizationService,localizedTextService, shortStringHelper)
{
_dataTypeService = dataTypeService;
_localizationService = localizationService;
+ _localizedTextService = localizedTextService;
_ioHelper = ioHelper;
}
@@ -44,11 +47,11 @@ namespace Umbraco.Web.PropertyEditors
return new ContentPickerConfigurationEditor(_ioHelper);
}
- protected override IDataValueEditor CreateValueEditor() => new ContentPickerPropertyValueEditor(_dataTypeService, _localizationService, ShortStringHelper, Attribute);
+ protected override IDataValueEditor CreateValueEditor() => new ContentPickerPropertyValueEditor(_dataTypeService, _localizationService, _localizedTextService, ShortStringHelper, Attribute);
internal class ContentPickerPropertyValueEditor : DataValueEditor, IDataValueReference
{
- public ContentPickerPropertyValueEditor(IDataTypeService dataTypeService, ILocalizationService localizationService, IShortStringHelper shortStringHelper, DataEditorAttribute attribute) : base(dataTypeService, localizationService,Current.Services.TextService, shortStringHelper, attribute)
+ public ContentPickerPropertyValueEditor(IDataTypeService dataTypeService, ILocalizationService localizationService, ILocalizedTextService localizedTextService, IShortStringHelper shortStringHelper, DataEditorAttribute attribute) : base(dataTypeService, localizationService, localizedTextService, shortStringHelper, attribute)
{
}
diff --git a/src/Umbraco.Web/PropertyEditors/DateTimePropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/DateTimePropertyEditor.cs
index 00bfa3cfcf..6656efcabc 100644
--- a/src/Umbraco.Web/PropertyEditors/DateTimePropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/DateTimePropertyEditor.cs
@@ -3,6 +3,7 @@ using Umbraco.Web.Composing;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Services;
using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors
@@ -24,8 +25,8 @@ namespace Umbraco.Web.PropertyEditors
/// Initializes a new instance of the class.
///
///
- public DateTimePropertyEditor(ILogger logger, IIOHelper ioHelper, IShortStringHelper shortStringHelper)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService,Current.Services.TextService, shortStringHelper)
+ public DateTimePropertyEditor(ILogger logger, IIOHelper ioHelper, IDataTypeService dataTypeService, ILocalizationService localizationService, ILocalizedTextService localizedTextService, IShortStringHelper shortStringHelper)
+ : base(logger, dataTypeService, localizationService,localizedTextService, shortStringHelper)
{
_ioHelper = ioHelper;
}
diff --git a/src/Umbraco.Web/PropertyEditors/DateValueEditor.cs b/src/Umbraco.Web/PropertyEditors/DateValueEditor.cs
index f2886da5b2..3fdb95c757 100644
--- a/src/Umbraco.Web/PropertyEditors/DateValueEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/DateValueEditor.cs
@@ -4,6 +4,7 @@ using Umbraco.Web.Composing;
using Umbraco.Core.Models;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors
{
@@ -13,8 +14,8 @@ namespace Umbraco.Web.PropertyEditors
///
internal class DateValueEditor : DataValueEditor
{
- public DateValueEditor(IDataTypeService dataTypeService, ILocalizationService localizationService, IShortStringHelper shortStringHelper, DataEditorAttribute attribute)
- : base(dataTypeService, localizationService, Current.Services.TextService, shortStringHelper, attribute)
+ public DateValueEditor(IDataTypeService dataTypeService, ILocalizationService localizationService, ILocalizedTextService localizedTextService, IShortStringHelper shortStringHelper, DataEditorAttribute attribute)
+ : base(dataTypeService, localizationService, localizedTextService, shortStringHelper, attribute)
{
Validators.Add(new DateTimeValidator());
}
diff --git a/src/Umbraco.Web/PropertyEditors/DecimalPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/DecimalPropertyEditor.cs
index d2a508e1d0..e2f4a69f2c 100644
--- a/src/Umbraco.Web/PropertyEditors/DecimalPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/DecimalPropertyEditor.cs
@@ -3,6 +3,7 @@ using Umbraco.Web.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.PropertyEditors.Validators;
+using Umbraco.Core.Services;
using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors
@@ -21,8 +22,12 @@ namespace Umbraco.Web.PropertyEditors
///
/// Initializes a new instance of the class.
///
- public DecimalPropertyEditor(ILogger logger, IShortStringHelper shortStringHelper)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService,Current.Services.TextService, shortStringHelper)
+ public DecimalPropertyEditor(ILogger logger,
+ IDataTypeService dataTypeService,
+ ILocalizationService localizationService,
+ ILocalizedTextService localizedTextService,
+ IShortStringHelper shortStringHelper)
+ : base(logger, dataTypeService, localizationService, localizedTextService, shortStringHelper)
{ }
///
diff --git a/src/Umbraco.Web/PropertyEditors/EmailAddressPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/EmailAddressPropertyEditor.cs
index b5e715b0f4..675febf9c5 100644
--- a/src/Umbraco.Web/PropertyEditors/EmailAddressPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/EmailAddressPropertyEditor.cs
@@ -4,6 +4,7 @@ using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.PropertyEditors.Validators;
+using Umbraco.Core.Services;
using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors
@@ -21,8 +22,14 @@ namespace Umbraco.Web.PropertyEditors
///
/// The constructor will setup the property editor based on the attribute if one is found
///
- public EmailAddressPropertyEditor(ILogger logger, IIOHelper ioHelper, IShortStringHelper shortStringHelper)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService, shortStringHelper)
+ public EmailAddressPropertyEditor(
+ ILogger logger,
+ IIOHelper ioHelper,
+ IDataTypeService dataTypeService,
+ ILocalizationService localizationService,
+ ILocalizedTextService localizedTextService,
+ IShortStringHelper shortStringHelper)
+ : base(logger, dataTypeService, localizationService, localizedTextService, shortStringHelper)
{
_ioHelper = ioHelper;
}
diff --git a/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs
index f3a737c3f5..308e03ce3e 100644
--- a/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs
@@ -27,14 +27,16 @@ namespace Umbraco.Web.PropertyEditors
private readonly UploadAutoFillProperties _uploadAutoFillProperties;
private readonly IDataTypeService _dataTypeService;
private readonly ILocalizationService _localizationService;
+ private readonly ILocalizedTextService _localizedTextService;
- public FileUploadPropertyEditor(ILogger logger, IMediaFileSystem mediaFileSystem, IContentSection contentSection, IDataTypeService dataTypeService, ILocalizationService localizationService, IShortStringHelper shortStringHelper)
- : base(logger, dataTypeService, localizationService, Current.Services.TextService, shortStringHelper)
+ public FileUploadPropertyEditor(ILogger logger, IMediaFileSystem mediaFileSystem, IContentSection contentSection, IDataTypeService dataTypeService, ILocalizationService localizationService, ILocalizedTextService localizedTextService, IShortStringHelper shortStringHelper)
+ : base(logger, dataTypeService, localizationService, localizedTextService, shortStringHelper)
{
_mediaFileSystem = mediaFileSystem ?? throw new ArgumentNullException(nameof(mediaFileSystem));
_contentSection = contentSection;
_dataTypeService = dataTypeService;
_localizationService = localizationService;
+ _localizedTextService = localizedTextService;
_uploadAutoFillProperties = new UploadAutoFillProperties(_mediaFileSystem, logger, contentSection);
}
@@ -44,8 +46,8 @@ namespace Umbraco.Web.PropertyEditors
/// The corresponding property value editor.
protected override IDataValueEditor CreateValueEditor()
{
- var editor = new FileUploadPropertyValueEditor(Attribute, _mediaFileSystem, _dataTypeService, _localizationService, ShortStringHelper);
- editor.Validators.Add(new UploadFileTypeValidator());
+ var editor = new FileUploadPropertyValueEditor(Attribute, _mediaFileSystem, _dataTypeService, _localizationService, _localizedTextService, ShortStringHelper);
+ editor.Validators.Add(new UploadFileTypeValidator(_localizedTextService));
return editor;
}
diff --git a/src/Umbraco.Web/PropertyEditors/FileUploadPropertyValueEditor.cs b/src/Umbraco.Web/PropertyEditors/FileUploadPropertyValueEditor.cs
index f850bb9c1b..22b377b01f 100644
--- a/src/Umbraco.Web/PropertyEditors/FileUploadPropertyValueEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/FileUploadPropertyValueEditor.cs
@@ -17,8 +17,8 @@ namespace Umbraco.Web.PropertyEditors
{
private readonly IMediaFileSystem _mediaFileSystem;
- public FileUploadPropertyValueEditor(DataEditorAttribute attribute, IMediaFileSystem mediaFileSystem, IDataTypeService dataTypeService, ILocalizationService localizationService, IShortStringHelper shortStringHelper)
- : base(dataTypeService, localizationService, Current.Services.TextService, shortStringHelper, attribute)
+ public FileUploadPropertyValueEditor(DataEditorAttribute attribute, IMediaFileSystem mediaFileSystem, IDataTypeService dataTypeService, ILocalizationService localizationService, ILocalizedTextService localizedTextService, IShortStringHelper shortStringHelper)
+ : base(dataTypeService, localizationService, localizedTextService, shortStringHelper, attribute)
{
_mediaFileSystem = mediaFileSystem ?? throw new ArgumentNullException(nameof(mediaFileSystem));
}
diff --git a/src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs
index 4b9ad490aa..ac5b1dda38 100644
--- a/src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs
@@ -46,12 +46,13 @@ namespace Umbraco.Web.PropertyEditors
IUmbracoContextAccessor umbracoContextAccessor,
IDataTypeService dataTypeService,
ILocalizationService localizationService,
+ ILocalizedTextService localizedTextService,
HtmlImageSourceParser imageSourceParser,
RichTextEditorPastedImages pastedImages,
HtmlLocalLinkParser localLinkParser,
IIOHelper ioHelper,
IShortStringHelper shortStringHelper)
- : base(logger, dataTypeService, localizationService, Current.Services.TextService, shortStringHelper)
+ : base(logger, dataTypeService, localizationService, localizedTextService, shortStringHelper)
{
_umbracoContextAccessor = umbracoContextAccessor;
_dataTypeService = dataTypeService;
@@ -71,7 +72,7 @@ namespace Umbraco.Web.PropertyEditors
/// Overridden to ensure that the value is validated
///
///
- protected override IDataValueEditor CreateValueEditor() => new GridPropertyValueEditor(Attribute, _mediaService, _contentTypeBaseServiceProvider, _umbracoContextAccessor, _logger, _dataTypeService, _localizationService, _imageSourceParser, _pastedImages, _localLinkParser, ShortStringHelper);
+ protected override IDataValueEditor CreateValueEditor() => new GridPropertyValueEditor(Attribute, _mediaService, _contentTypeBaseServiceProvider, _umbracoContextAccessor, _logger, DataTypeService, LocalizationService, LocalizedTextService, _imageSourceParser, _pastedImages, _localLinkParser, ShortStringHelper);
protected override IConfigurationEditor CreateConfigurationEditor() => new GridConfigurationEditor(_ioHelper);
@@ -91,17 +92,18 @@ namespace Umbraco.Web.PropertyEditors
ILogger logger,
IDataTypeService dataTypeService,
ILocalizationService localizationService,
+ ILocalizedTextService localizedTextService,
HtmlImageSourceParser imageSourceParser,
RichTextEditorPastedImages pastedImages,
HtmlLocalLinkParser localLinkParser,
IShortStringHelper shortStringHelper)
- : base(dataTypeService, localizationService, Current.Services.TextService, shortStringHelper, attribute)
+ : base(dataTypeService, localizationService, localizedTextService, shortStringHelper, attribute)
{
_umbracoContextAccessor = umbracoContextAccessor;
_imageSourceParser = imageSourceParser;
_pastedImages = pastedImages;
- _richTextPropertyValueEditor = new RichTextPropertyEditor.RichTextPropertyValueEditor(attribute, mediaService, contentTypeBaseServiceProvider, umbracoContextAccessor,logger, dataTypeService, localizationService, shortStringHelper, imageSourceParser, localLinkParser, pastedImages);
- _mediaPickerPropertyValueEditor = new MediaPickerPropertyEditor.MediaPickerPropertyValueEditor(dataTypeService, localizationService, shortStringHelper, attribute);
+ _richTextPropertyValueEditor = new RichTextPropertyEditor.RichTextPropertyValueEditor(attribute, umbracoContextAccessor, dataTypeService, localizationService, localizedTextService, shortStringHelper, imageSourceParser, localLinkParser, pastedImages);
+ _mediaPickerPropertyValueEditor = new MediaPickerPropertyEditor.MediaPickerPropertyValueEditor(dataTypeService, localizationService, localizedTextService, shortStringHelper, attribute);
}
///
diff --git a/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyEditor.cs
index 7901f2d862..40be6637a1 100644
--- a/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyEditor.cs
@@ -60,7 +60,7 @@ namespace Umbraco.Web.PropertyEditors
/// Creates the corresponding property value editor.
///
/// The corresponding property value editor.
- protected override IDataValueEditor CreateValueEditor() => new ImageCropperPropertyValueEditor(Attribute, Logger, _mediaFileSystem, _dataTypeService, _localizationService, ShortStringHelper);
+ protected override IDataValueEditor CreateValueEditor() => new ImageCropperPropertyValueEditor(Attribute, Logger, _mediaFileSystem, DataTypeService, LocalizationService, LocalizedTextService, ShortStringHelper);
///
/// Creates the corresponding preValue editor.
diff --git a/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyValueEditor.cs b/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyValueEditor.cs
index edc13277b0..1afad2e9e7 100644
--- a/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyValueEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyValueEditor.cs
@@ -23,8 +23,8 @@ namespace Umbraco.Web.PropertyEditors
private readonly ILogger _logger;
private readonly IMediaFileSystem _mediaFileSystem;
- public ImageCropperPropertyValueEditor(DataEditorAttribute attribute, ILogger logger, IMediaFileSystem mediaFileSystem, IDataTypeService dataTypeService, ILocalizationService localizationService, IShortStringHelper shortStringHelper)
- : base(dataTypeService, localizationService, Current.Services.TextService, shortStringHelper, attribute)
+ public ImageCropperPropertyValueEditor(DataEditorAttribute attribute, ILogger logger, IMediaFileSystem mediaFileSystem, IDataTypeService dataTypeService, ILocalizationService localizationService, ILocalizedTextService localizedTextService, IShortStringHelper shortStringHelper)
+ : base(dataTypeService, localizationService, localizedTextService, shortStringHelper, attribute)
{
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
_mediaFileSystem = mediaFileSystem ?? throw new ArgumentNullException(nameof(mediaFileSystem));
diff --git a/src/Umbraco.Web/PropertyEditors/ListViewPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/ListViewPropertyEditor.cs
index a484d326fe..9dbd51be66 100644
--- a/src/Umbraco.Web/PropertyEditors/ListViewPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/ListViewPropertyEditor.cs
@@ -3,6 +3,7 @@ using Umbraco.Web.Composing;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Services;
using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors
@@ -25,8 +26,14 @@ namespace Umbraco.Web.PropertyEditors
/// Initializes a new instance of the class.
///
///
- public ListViewPropertyEditor(ILogger logger, IIOHelper iioHelper, IShortStringHelper shortStringHelper)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService, shortStringHelper)
+ public ListViewPropertyEditor(
+ ILogger logger,
+ IIOHelper iioHelper,
+ IDataTypeService dataTypeService,
+ ILocalizationService localizationService,
+ ILocalizedTextService localizedTextService,
+ IShortStringHelper shortStringHelper)
+ : base(logger, dataTypeService, localizationService, localizedTextService, shortStringHelper)
{
_iioHelper = iioHelper;
}
diff --git a/src/Umbraco.Web/PropertyEditors/MarkdownPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/MarkdownPropertyEditor.cs
index 5a88d4b6e7..b875670023 100644
--- a/src/Umbraco.Web/PropertyEditors/MarkdownPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/MarkdownPropertyEditor.cs
@@ -3,6 +3,7 @@ using Umbraco.Web.Composing;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Services;
using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors
@@ -24,8 +25,14 @@ namespace Umbraco.Web.PropertyEditors
///
/// Initializes a new instance of the class.
///
- public MarkdownPropertyEditor(ILogger logger, IIOHelper ioHelper, IShortStringHelper shortStringHelper)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService, shortStringHelper)
+ public MarkdownPropertyEditor(
+ ILogger logger,
+ IIOHelper ioHelper,
+ IDataTypeService dataTypeService,
+ ILocalizationService localizationService,
+ ILocalizedTextService localizedTextService,
+ IShortStringHelper shortStringHelper)
+ : base(logger, dataTypeService, localizationService, localizedTextService, shortStringHelper)
{
_ioHelper = ioHelper;
}
diff --git a/src/Umbraco.Web/PropertyEditors/MediaPickerPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/MediaPickerPropertyEditor.cs
index a7eaf822b8..04e87bc9fe 100644
--- a/src/Umbraco.Web/PropertyEditors/MediaPickerPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/MediaPickerPropertyEditor.cs
@@ -23,8 +23,6 @@ namespace Umbraco.Web.PropertyEditors
Icon = Constants.Icons.MediaImage)]
public class MediaPickerPropertyEditor : DataEditor
{
- private readonly IDataTypeService _dataTypeService;
- private readonly ILocalizationService _localizationService;
private readonly IIOHelper _ioHelper;
///
@@ -39,20 +37,18 @@ namespace Umbraco.Web.PropertyEditors
ILocalizedTextService localizedTextService)
: base(logger, dataTypeService, localizationService, localizedTextService, shortStringHelper)
{
- _dataTypeService = dataTypeService;
- _localizationService = localizationService;
_ioHelper = ioHelper;
}
///
protected override IConfigurationEditor CreateConfigurationEditor() => new MediaPickerConfigurationEditor(_ioHelper);
- protected override IDataValueEditor CreateValueEditor() => new MediaPickerPropertyValueEditor(_dataTypeService, _localizationService, ShortStringHelper, Attribute);
+ protected override IDataValueEditor CreateValueEditor() => new MediaPickerPropertyValueEditor(DataTypeService, LocalizationService, LocalizedTextService, ShortStringHelper, Attribute);
internal class MediaPickerPropertyValueEditor : DataValueEditor, IDataValueReference
{
- public MediaPickerPropertyValueEditor(IDataTypeService dataTypeService, ILocalizationService localizationService, IShortStringHelper shortStringHelper, DataEditorAttribute attribute)
- : base(dataTypeService,localizationService, Current.Services.TextService, shortStringHelper,attribute)
+ public MediaPickerPropertyValueEditor(IDataTypeService dataTypeService, ILocalizationService localizationService, ILocalizedTextService localizedTextService, IShortStringHelper shortStringHelper, DataEditorAttribute attribute)
+ : base(dataTypeService,localizationService, localizedTextService, shortStringHelper,attribute)
{
}
diff --git a/src/Umbraco.Web/PropertyEditors/MemberGroupPickerPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/MemberGroupPickerPropertyEditor.cs
index 4c546b1815..68dee45252 100644
--- a/src/Umbraco.Web/PropertyEditors/MemberGroupPickerPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/MemberGroupPickerPropertyEditor.cs
@@ -2,6 +2,7 @@
using Umbraco.Web.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Services;
using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors
@@ -15,8 +16,13 @@ namespace Umbraco.Web.PropertyEditors
Icon = Constants.Icons.MemberGroup)]
public class MemberGroupPickerPropertyEditor : DataEditor
{
- public MemberGroupPickerPropertyEditor(ILogger logger, IShortStringHelper shortStringHelper)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService, shortStringHelper)
+ public MemberGroupPickerPropertyEditor(
+ ILogger logger,
+ IDataTypeService dataTypeService,
+ ILocalizationService localizationService,
+ ILocalizedTextService localizedTextService,
+ IShortStringHelper shortStringHelper)
+ : base(logger, dataTypeService, localizationService, localizedTextService, shortStringHelper)
{ }
}
}
diff --git a/src/Umbraco.Web/PropertyEditors/MemberPickerPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/MemberPickerPropertyEditor.cs
index 68e95b7a2b..e378cd47f0 100644
--- a/src/Umbraco.Web/PropertyEditors/MemberPickerPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/MemberPickerPropertyEditor.cs
@@ -2,6 +2,7 @@
using Umbraco.Web.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Services;
using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors
@@ -15,8 +16,13 @@ namespace Umbraco.Web.PropertyEditors
Icon = Constants.Icons.Member)]
public class MemberPickerPropertyEditor : DataEditor
{
- public MemberPickerPropertyEditor(ILogger logger, IShortStringHelper shortStringHelper)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService, shortStringHelper)
+ public MemberPickerPropertyEditor(
+ ILogger logger,
+ IDataTypeService dataTypeService,
+ ILocalizationService localizationService,
+ ILocalizedTextService localizedTextService,
+ IShortStringHelper shortStringHelper)
+ : base(logger, dataTypeService, localizationService, localizedTextService, shortStringHelper)
{ }
protected override IConfigurationEditor CreateConfigurationEditor() => new MemberPickerConfiguration();
diff --git a/src/Umbraco.Web/PropertyEditors/MultiNodeTreePickerPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/MultiNodeTreePickerPropertyEditor.cs
index f3efcb0a18..0e8e495a02 100644
--- a/src/Umbraco.Web/PropertyEditors/MultiNodeTreePickerPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/MultiNodeTreePickerPropertyEditor.cs
@@ -19,26 +19,22 @@ namespace Umbraco.Web.PropertyEditors
Icon = "icon-page-add")]
public class MultiNodeTreePickerPropertyEditor : DataEditor
{
- private readonly IDataTypeService _dataTypeService;
- private readonly ILocalizationService _localizationService;
private readonly IIOHelper _ioHelper;
- public MultiNodeTreePickerPropertyEditor(ILogger logger, IDataTypeService dataTypeService, ILocalizationService localizationService, IIOHelper ioHelper, IShortStringHelper shortStringHelper)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService,Current.Services.TextService, shortStringHelper)
+ public MultiNodeTreePickerPropertyEditor(ILogger logger, IDataTypeService dataTypeService, ILocalizationService localizationService, ILocalizedTextService localizedTextService, IIOHelper ioHelper, IShortStringHelper shortStringHelper)
+ : base(logger, dataTypeService, localizationService, localizedTextService, shortStringHelper)
{
- _dataTypeService = dataTypeService;
- _localizationService = localizationService;
_ioHelper = ioHelper;
}
protected override IConfigurationEditor CreateConfigurationEditor() => new MultiNodePickerConfigurationEditor(_ioHelper);
- protected override IDataValueEditor CreateValueEditor() => new MultiNodeTreePickerPropertyValueEditor(_dataTypeService, _localizationService, ShortStringHelper, Attribute);
+ protected override IDataValueEditor CreateValueEditor() => new MultiNodeTreePickerPropertyValueEditor(DataTypeService, LocalizationService, LocalizedTextService, ShortStringHelper, Attribute);
public class MultiNodeTreePickerPropertyValueEditor : DataValueEditor, IDataValueReference
{
- public MultiNodeTreePickerPropertyValueEditor(IDataTypeService dataTypeService, ILocalizationService localizationService, IShortStringHelper shortStringHelper, DataEditorAttribute attribute)
- : base(dataTypeService, localizationService, Current.Services.TextService, shortStringHelper, attribute)
+ public MultiNodeTreePickerPropertyValueEditor(IDataTypeService dataTypeService, ILocalizationService localizationService, ILocalizedTextService localizedTextService, IShortStringHelper shortStringHelper, DataEditorAttribute attribute)
+ : base(dataTypeService, localizationService, localizedTextService, shortStringHelper, attribute)
{
}
diff --git a/src/Umbraco.Web/PropertyEditors/MultiUrlPickerPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/MultiUrlPickerPropertyEditor.cs
index d4b0692ebf..394b4cd0f2 100644
--- a/src/Umbraco.Web/PropertyEditors/MultiUrlPickerPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/MultiUrlPickerPropertyEditor.cs
@@ -22,22 +22,18 @@ namespace Umbraco.Web.PropertyEditors
{
private readonly IEntityService _entityService;
private readonly IPublishedSnapshotAccessor _publishedSnapshotAccessor;
- private readonly IDataTypeService _dataTypeService;
- private readonly ILocalizationService _localizationService;
private readonly IIOHelper _ioHelper;
- public MultiUrlPickerPropertyEditor(ILogger logger, IEntityService entityService, IPublishedSnapshotAccessor publishedSnapshotAccessor, IDataTypeService dataTypeService, ILocalizationService localizationService, IIOHelper ioHelper, IShortStringHelper shortStringHelper)
- : base(logger, dataTypeService, localizationService, Current.Services.TextService, shortStringHelper, EditorType.PropertyValue)
+ public MultiUrlPickerPropertyEditor(ILogger logger, IEntityService entityService, IPublishedSnapshotAccessor publishedSnapshotAccessor, IDataTypeService dataTypeService, ILocalizationService localizationService, ILocalizedTextService localizedTextService, IIOHelper ioHelper, IShortStringHelper shortStringHelper)
+ : base(logger, dataTypeService, localizationService, localizedTextService, shortStringHelper, EditorType.PropertyValue)
{
_entityService = entityService ?? throw new ArgumentNullException(nameof(entityService));
_publishedSnapshotAccessor = publishedSnapshotAccessor ?? throw new ArgumentNullException(nameof(publishedSnapshotAccessor));
- _dataTypeService = dataTypeService;
- _localizationService = localizationService;
_ioHelper = ioHelper;
}
protected override IConfigurationEditor CreateConfigurationEditor() => new MultiUrlPickerConfigurationEditor(_ioHelper);
- protected override IDataValueEditor CreateValueEditor() => new MultiUrlPickerValueEditor(_entityService, _publishedSnapshotAccessor, Logger, _dataTypeService, _localizationService, ShortStringHelper, Attribute);
+ protected override IDataValueEditor CreateValueEditor() => new MultiUrlPickerValueEditor(_entityService, _publishedSnapshotAccessor, Logger, DataTypeService, LocalizationService, LocalizedTextService, ShortStringHelper, Attribute);
}
}
diff --git a/src/Umbraco.Web/PropertyEditors/MultiUrlPickerValueEditor.cs b/src/Umbraco.Web/PropertyEditors/MultiUrlPickerValueEditor.cs
index 5564d44e4a..ab0f927f47 100644
--- a/src/Umbraco.Web/PropertyEditors/MultiUrlPickerValueEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/MultiUrlPickerValueEditor.cs
@@ -23,8 +23,8 @@ namespace Umbraco.Web.PropertyEditors
private readonly ILogger _logger;
private readonly IPublishedSnapshotAccessor _publishedSnapshotAccessor;
- public MultiUrlPickerValueEditor(IEntityService entityService, IPublishedSnapshotAccessor publishedSnapshotAccessor, ILogger logger, IDataTypeService dataTypeService, ILocalizationService localizationService, IShortStringHelper shortStringHelper, DataEditorAttribute attribute)
- : base(dataTypeService, localizationService, Current.Services.TextService, shortStringHelper, attribute)
+ public MultiUrlPickerValueEditor(IEntityService entityService, IPublishedSnapshotAccessor publishedSnapshotAccessor, ILogger logger, IDataTypeService dataTypeService, ILocalizationService localizationService, ILocalizedTextService localizedTextService, IShortStringHelper shortStringHelper, DataEditorAttribute attribute)
+ : base(dataTypeService, localizationService, localizedTextService, shortStringHelper, attribute)
{
_entityService = entityService ?? throw new ArgumentNullException(nameof(entityService));
_publishedSnapshotAccessor = publishedSnapshotAccessor ?? throw new ArgumentNullException(nameof(publishedSnapshotAccessor));
diff --git a/src/Umbraco.Web/PropertyEditors/MultipleTextStringPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/MultipleTextStringPropertyEditor.cs
index ee5cbaebfb..56c9b7a63c 100644
--- a/src/Umbraco.Web/PropertyEditors/MultipleTextStringPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/MultipleTextStringPropertyEditor.cs
@@ -38,7 +38,7 @@ namespace Umbraco.Web.PropertyEditors
/// Initializes a new instance of the class.
///
public MultipleTextStringPropertyEditor(ILogger logger, IIOHelper ioHelper, IDataTypeService dataTypeService, ILocalizationService localizationService, ILocalizedTextService localizedTextService, IShortStringHelper shortStringHelper)
- : base(logger, dataTypeService, localizationService, Current.Services.TextService, shortStringHelper)
+ : base(logger, dataTypeService, localizationService, localizedTextService, shortStringHelper)
{
_ioHelper = ioHelper;
_dataTypeService = dataTypeService;
@@ -60,7 +60,7 @@ namespace Umbraco.Web.PropertyEditors
private readonly ILocalizedTextService _localizedTextService;
public MultipleTextStringPropertyValueEditor(IDataTypeService dataTypeService, ILocalizationService localizationService, ILocalizedTextService localizedTextService, IShortStringHelper shortStringHelper, DataEditorAttribute attribute)
- : base(dataTypeService, localizationService, Current.Services.TextService, shortStringHelper, attribute)
+ : base(dataTypeService, localizationService, localizedTextService, shortStringHelper, attribute)
{
_localizedTextService = localizedTextService;
}
diff --git a/src/Umbraco.Web/PropertyEditors/NestedContentPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/NestedContentPropertyEditor.cs
index 05f3752664..5ed783a44c 100644
--- a/src/Umbraco.Web/PropertyEditors/NestedContentPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/NestedContentPropertyEditor.cs
@@ -30,9 +30,7 @@ namespace Umbraco.Web.PropertyEditors
public class NestedContentPropertyEditor : DataEditor
{
private readonly Lazy _propertyEditors;
- private readonly IDataTypeService _dataTypeService;
private readonly IContentTypeService _contentTypeService;
- private readonly ILocalizationService _localizationService;
private readonly IIOHelper _ioHelper;
internal const string ContentTypeAliasPropertyKey = "ncContentTypeAlias";
@@ -49,9 +47,7 @@ namespace Umbraco.Web.PropertyEditors
: base (logger, dataTypeService, localizationService, localizedTextService, shortStringHelper)
{
_propertyEditors = propertyEditors;
- _dataTypeService = dataTypeService;
_contentTypeService = contentTypeService;
- _localizationService = localizationService;
_ioHelper = ioHelper;
}
@@ -66,25 +62,29 @@ namespace Umbraco.Web.PropertyEditors
#region Value Editor
- protected override IDataValueEditor CreateValueEditor() => new NestedContentPropertyValueEditor(_dataTypeService, _localizationService, _contentTypeService, ShortStringHelper, Attribute, PropertyEditors);
+ protected override IDataValueEditor CreateValueEditor() => new NestedContentPropertyValueEditor(DataTypeService, LocalizationService, LocalizedTextService, _contentTypeService, ShortStringHelper, Attribute, PropertyEditors);
internal class NestedContentPropertyValueEditor : DataValueEditor, IDataValueReference
{
private readonly PropertyEditorCollection _propertyEditors;
+ private readonly IContentTypeService _contentTypeService;
private readonly IDataTypeService _dataTypeService;
private readonly NestedContentValues _nestedContentValues;
- private readonly Lazy> _contentTypes = new Lazy>(() =>
- Current.Services.ContentTypeService.GetAll().ToDictionary(c => c.Alias)
- );
+ private readonly Lazy> _contentTypes;
- public NestedContentPropertyValueEditor(IDataTypeService dataTypeService, ILocalizationService localizationService, IContentTypeService contentTypeService, IShortStringHelper shortStringHelper, DataEditorAttribute attribute, PropertyEditorCollection propertyEditors)
- : base(dataTypeService, localizationService, Current.Services.TextService, shortStringHelper, attribute)
+ public NestedContentPropertyValueEditor(IDataTypeService dataTypeService, ILocalizationService localizationService, ILocalizedTextService localizedTextService, IContentTypeService contentTypeService, IShortStringHelper shortStringHelper, DataEditorAttribute attribute, PropertyEditorCollection propertyEditors)
+ : base(dataTypeService, localizationService, localizedTextService, shortStringHelper, attribute)
{
_propertyEditors = propertyEditors;
+ _contentTypeService = contentTypeService;
_dataTypeService = dataTypeService;
_nestedContentValues = new NestedContentValues(contentTypeService);
Validators.Add(new NestedContentValidator(propertyEditors, dataTypeService, _nestedContentValues));
+
+ _contentTypes = new Lazy>(() =>
+ _contentTypeService.GetAll().ToDictionary(c => c.Alias)
+ );
}
///
diff --git a/src/Umbraco.Web/PropertyEditors/ParameterEditors/ContentTypeParameterEditor.cs b/src/Umbraco.Web/PropertyEditors/ParameterEditors/ContentTypeParameterEditor.cs
index abd994541e..9513b9d0f3 100644
--- a/src/Umbraco.Web/PropertyEditors/ParameterEditors/ContentTypeParameterEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/ParameterEditors/ContentTypeParameterEditor.cs
@@ -1,6 +1,7 @@
using Umbraco.Web.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Services;
using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors.ParameterEditors
@@ -18,8 +19,13 @@ namespace Umbraco.Web.PropertyEditors.ParameterEditors
///
/// Initializes a new instance of the class.
///
- public ContentTypeParameterEditor(ILogger logger, IShortStringHelper shortStringHelper)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService,Current.Services.TextService, shortStringHelper)
+ public ContentTypeParameterEditor(
+ ILogger logger,
+ IDataTypeService dataTypeService,
+ ILocalizationService localizationService,
+ ILocalizedTextService localizedTextService,
+ IShortStringHelper shortStringHelper)
+ : base(logger, dataTypeService, localizationService, localizedTextService, shortStringHelper)
{
// configure
DefaultConfiguration.Add("multiple", false);
diff --git a/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultipleContentPickerParameterEditor.cs b/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultipleContentPickerParameterEditor.cs
index 571a1b4a1b..9dfdbc6721 100644
--- a/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultipleContentPickerParameterEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultipleContentPickerParameterEditor.cs
@@ -2,6 +2,7 @@
using Umbraco.Web.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Services;
using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors.ParameterEditors
@@ -19,8 +20,13 @@ namespace Umbraco.Web.PropertyEditors.ParameterEditors
///
/// Initializes a new instance of the class.
///
- public MultipleContentPickerParameterEditor(ILogger logger, IShortStringHelper shortStringHelper)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService, shortStringHelper)
+ public MultipleContentPickerParameterEditor(
+ ILogger logger,
+ IDataTypeService dataTypeService,
+ ILocalizationService localizationService,
+ ILocalizedTextService localizedTextService,
+ IShortStringHelper shortStringHelper)
+ : base(logger, dataTypeService, localizationService, localizedTextService, shortStringHelper)
{
// configure
DefaultConfiguration.Add("multiPicker", "1");
diff --git a/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultipleContentTypeParameterEditor.cs b/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultipleContentTypeParameterEditor.cs
index f13d0474d9..bebfea3ad6 100644
--- a/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultipleContentTypeParameterEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultipleContentTypeParameterEditor.cs
@@ -1,6 +1,7 @@
using Umbraco.Web.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Services;
using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors.ParameterEditors
@@ -12,8 +13,13 @@ namespace Umbraco.Web.PropertyEditors.ParameterEditors
"entitypicker")]
public class MultipleContentTypeParameterEditor : DataEditor
{
- public MultipleContentTypeParameterEditor(ILogger logger, IShortStringHelper shortStringHelper)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService,Current.Services.TextService, shortStringHelper)
+ public MultipleContentTypeParameterEditor(
+ ILogger logger,
+ IDataTypeService dataTypeService,
+ ILocalizationService localizationService,
+ ILocalizedTextService localizedTextService,
+ IShortStringHelper shortStringHelper)
+ : base(logger, dataTypeService, localizationService, localizedTextService, shortStringHelper)
{
// configure
DefaultConfiguration.Add("multiple", true);
diff --git a/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultipleMediaPickerParameterEditor.cs b/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultipleMediaPickerParameterEditor.cs
index a60573104a..91e33735ea 100644
--- a/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultipleMediaPickerParameterEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultipleMediaPickerParameterEditor.cs
@@ -2,6 +2,7 @@
using Umbraco.Web.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Services;
using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors.ParameterEditors
@@ -20,8 +21,12 @@ namespace Umbraco.Web.PropertyEditors.ParameterEditors
///
/// Initializes a new instance of the class.
///
- public MultipleMediaPickerParameterEditor(ILogger logger, IShortStringHelper shortStringHelper)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService, shortStringHelper)
+ public MultipleMediaPickerParameterEditor(ILogger logger,
+ IDataTypeService dataTypeService,
+ ILocalizationService localizationService,
+ ILocalizedTextService localizedTextService,
+ IShortStringHelper shortStringHelper)
+ : base(logger, dataTypeService, localizationService, localizedTextService, shortStringHelper)
{
DefaultConfiguration.Add("multiPicker", "1");
}
diff --git a/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultiplePropertyGroupParameterEditor.cs b/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultiplePropertyGroupParameterEditor.cs
index cbfcef9d85..719d9eb2eb 100644
--- a/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultiplePropertyGroupParameterEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultiplePropertyGroupParameterEditor.cs
@@ -1,6 +1,7 @@
using Umbraco.Web.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Services;
using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors.ParameterEditors
@@ -12,8 +13,13 @@ namespace Umbraco.Web.PropertyEditors.ParameterEditors
"entitypicker")]
public class MultiplePropertyGroupParameterEditor : DataEditor
{
- public MultiplePropertyGroupParameterEditor(ILogger logger, IShortStringHelper shortStringHelper)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService, shortStringHelper)
+ public MultiplePropertyGroupParameterEditor(
+ ILogger logger,
+ IDataTypeService dataTypeService,
+ ILocalizationService localizationService,
+ ILocalizedTextService localizedTextService,
+ IShortStringHelper shortStringHelper)
+ : base(logger, dataTypeService, localizationService, localizedTextService, shortStringHelper)
{
// configure
DefaultConfiguration.Add("multiple", true);
diff --git a/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultiplePropertyTypeParameterEditor.cs b/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultiplePropertyTypeParameterEditor.cs
index f4cf788dd1..27eefe491f 100644
--- a/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultiplePropertyTypeParameterEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultiplePropertyTypeParameterEditor.cs
@@ -1,6 +1,7 @@
using Umbraco.Web.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Services;
using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors.ParameterEditors
@@ -12,8 +13,12 @@ namespace Umbraco.Web.PropertyEditors.ParameterEditors
"entitypicker")]
public class MultiplePropertyTypeParameterEditor : DataEditor
{
- public MultiplePropertyTypeParameterEditor(ILogger logger, IShortStringHelper shortStringHelper)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService, shortStringHelper)
+ public MultiplePropertyTypeParameterEditor(ILogger logger,
+ IDataTypeService dataTypeService,
+ ILocalizationService localizationService,
+ ILocalizedTextService localizedTextService,
+ IShortStringHelper shortStringHelper)
+ : base(logger, dataTypeService, localizationService, localizedTextService, shortStringHelper)
{
// configure
DefaultConfiguration.Add("multiple", "1");
diff --git a/src/Umbraco.Web/PropertyEditors/ParameterEditors/PropertyGroupParameterEditor.cs b/src/Umbraco.Web/PropertyEditors/ParameterEditors/PropertyGroupParameterEditor.cs
index b0a926586d..3cd120f44d 100644
--- a/src/Umbraco.Web/PropertyEditors/ParameterEditors/PropertyGroupParameterEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/ParameterEditors/PropertyGroupParameterEditor.cs
@@ -1,6 +1,7 @@
using Umbraco.Web.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Services;
using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors.ParameterEditors
@@ -12,8 +13,13 @@ namespace Umbraco.Web.PropertyEditors.ParameterEditors
"entitypicker")]
public class PropertyGroupParameterEditor : DataEditor
{
- public PropertyGroupParameterEditor(ILogger logger, IShortStringHelper shortStringHelper)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService, shortStringHelper)
+ public PropertyGroupParameterEditor(
+ ILogger logger,
+ IDataTypeService dataTypeService,
+ ILocalizationService localizationService,
+ ILocalizedTextService localizedTextService,
+ IShortStringHelper shortStringHelper)
+ : base(logger, dataTypeService, localizationService, localizedTextService, shortStringHelper)
{
// configure
DefaultConfiguration.Add("multiple", "0");
diff --git a/src/Umbraco.Web/PropertyEditors/ParameterEditors/PropertyTypeParameterEditor.cs b/src/Umbraco.Web/PropertyEditors/ParameterEditors/PropertyTypeParameterEditor.cs
index 4e49741da3..0526d60f84 100644
--- a/src/Umbraco.Web/PropertyEditors/ParameterEditors/PropertyTypeParameterEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/ParameterEditors/PropertyTypeParameterEditor.cs
@@ -1,6 +1,7 @@
using Umbraco.Web.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Services;
using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors.ParameterEditors
@@ -12,8 +13,13 @@ namespace Umbraco.Web.PropertyEditors.ParameterEditors
"entitypicker")]
public class PropertyTypeParameterEditor : DataEditor
{
- public PropertyTypeParameterEditor(ILogger logger, IShortStringHelper shortStringHelper)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService,Current.Services.TextService, shortStringHelper)
+ public PropertyTypeParameterEditor(
+ ILogger logger,
+ IDataTypeService dataTypeService,
+ ILocalizationService localizationService,
+ ILocalizedTextService localizedTextService,
+ IShortStringHelper shortStringHelper)
+ : base(logger, dataTypeService, localizationService, localizedTextService, shortStringHelper)
{
// configure
DefaultConfiguration.Add("multiple", "0");
diff --git a/src/Umbraco.Web/PropertyEditors/RadioButtonsPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/RadioButtonsPropertyEditor.cs
index c010d21cd2..e25bb758d2 100644
--- a/src/Umbraco.Web/PropertyEditors/RadioButtonsPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/RadioButtonsPropertyEditor.cs
@@ -20,16 +20,20 @@ namespace Umbraco.Web.PropertyEditors
Icon = "icon-target")]
public class RadioButtonsPropertyEditor : DataEditor
{
- private readonly ILocalizedTextService _textService;
private readonly IIOHelper _ioHelper;
///
/// The constructor will setup the property editor based on the attribute if one is found
///
- public RadioButtonsPropertyEditor(ILogger logger, ILocalizedTextService textService, IIOHelper ioHelper, IShortStringHelper shortStringHelper)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService,Current.Services.TextService, shortStringHelper)
+ public RadioButtonsPropertyEditor(
+ ILogger logger,
+ IIOHelper ioHelper,
+ IDataTypeService dataTypeService,
+ ILocalizationService localizationService,
+ ILocalizedTextService localizedTextService,
+ IShortStringHelper shortStringHelper)
+ : base(logger, dataTypeService, localizationService,localizedTextService, shortStringHelper)
{
- _textService = textService;
_ioHelper = ioHelper;
}
@@ -37,6 +41,6 @@ namespace Umbraco.Web.PropertyEditors
/// Return a custom pre-value editor
///
///
- protected override IConfigurationEditor CreateConfigurationEditor() => new ValueListConfigurationEditor(_textService, _ioHelper);
+ protected override IConfigurationEditor CreateConfigurationEditor() => new ValueListConfigurationEditor(LocalizedTextService, _ioHelper);
}
}
diff --git a/src/Umbraco.Web/PropertyEditors/RichTextPreValueController.cs b/src/Umbraco.Web/PropertyEditors/RichTextPreValueController.cs
index a3e6145ac5..698b3f46b3 100644
--- a/src/Umbraco.Web/PropertyEditors/RichTextPreValueController.cs
+++ b/src/Umbraco.Web/PropertyEditors/RichTextPreValueController.cs
@@ -1,8 +1,14 @@
using System.Collections.Generic;
using System.Xml;
using Umbraco.Core;
-using Umbraco.Core.Composing;
+using Umbraco.Core.Cache;
+using Umbraco.Core.Configuration;
+using Umbraco.Web.Composing;
using Umbraco.Core.IO;
+using Umbraco.Core.Logging;
+using Umbraco.Core.Persistence;
+using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Web.Editors;
using Umbraco.Web.Models.ContentEditing;
using Umbraco.Web.Mvc;
@@ -15,6 +21,14 @@ namespace Umbraco.Web.PropertyEditors
[PluginController("UmbracoApi")]
public class RichTextPreValueController : UmbracoAuthorizedJsonController
{
+ private readonly IIOHelper _ioHelper;
+
+ public RichTextPreValueController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper, IShortStringHelper shortStringHelper, IIOHelper ioHelper)
+ : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper)
+ {
+ _ioHelper = ioHelper;
+ }
+
private static volatile bool _init;
private static readonly object Locker = new object();
private static readonly Dictionary Commands = new Dictionary();
@@ -40,7 +54,7 @@ namespace Umbraco.Web.PropertyEditors
return config;
}
- private static void EnsureInit()
+ private void EnsureInit()
{
if (_init == false)
@@ -51,7 +65,7 @@ namespace Umbraco.Web.PropertyEditors
{
// Load config
XmlDocument xd = new XmlDocument();
- xd.Load(Current.IOHelper.MapPath(SystemFiles.TinyMceConfig));
+ xd.Load(_ioHelper.MapPath(SystemFiles.TinyMceConfig));
foreach (XmlNode n in xd.DocumentElement.SelectNodes("//command"))
{
diff --git a/src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs
index 7895ad6372..0a6ef88781 100644
--- a/src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs
@@ -32,13 +32,7 @@ namespace Umbraco.Web.PropertyEditors
private readonly HtmlImageSourceParser _imageSourceParser;
private readonly HtmlLocalLinkParser _localLinkParser;
private readonly RichTextEditorPastedImages _pastedImages;
- private readonly IDataTypeService _dataTypeService;
- private readonly ILocalizationService _localizationService;
private readonly IIOHelper _ioHelper;
- private readonly ILogger _logger;
- private readonly IMediaService _mediaService;
- private readonly IContentTypeBaseServiceProvider _contentTypeBaseServiceProvider;
- private readonly IShortStringHelper _shortStringHelper;
///
/// The constructor will setup the property editor based on the attribute if one is found
@@ -62,20 +56,14 @@ namespace Umbraco.Web.PropertyEditors
_imageSourceParser = imageSourceParser;
_localLinkParser = localLinkParser;
_pastedImages = pastedImages;
- _dataTypeService = dataTypeService;
- _localizationService = localizationService;
_ioHelper = ioHelper;
- _logger = logger;
- _mediaService = mediaService;
- _contentTypeBaseServiceProvider = contentTypeBaseServiceProvider;
- _shortStringHelper = shortStringHelper;
}
///
/// Create a custom value editor
///
///
- protected override IDataValueEditor CreateValueEditor() => new RichTextPropertyValueEditor(Attribute, _mediaService, _contentTypeBaseServiceProvider, _umbracoContextAccessor, _logger, _dataTypeService, _localizationService, _shortStringHelper, _imageSourceParser, _localLinkParser, _pastedImages);
+ protected override IDataValueEditor CreateValueEditor() => new RichTextPropertyValueEditor(Attribute, _umbracoContextAccessor, DataTypeService, LocalizationService, LocalizedTextService, ShortStringHelper, _imageSourceParser, _localLinkParser, _pastedImages);
protected override IConfigurationEditor CreateConfigurationEditor() => new RichTextConfigurationEditor(_ioHelper);
@@ -91,8 +79,17 @@ namespace Umbraco.Web.PropertyEditors
private readonly HtmlLocalLinkParser _localLinkParser;
private readonly RichTextEditorPastedImages _pastedImages;
- public RichTextPropertyValueEditor(DataEditorAttribute attribute, IMediaService mediaService, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider, IUmbracoContextAccessor umbracoContextAccessor, ILogger logger, IDataTypeService dataTypeService, ILocalizationService localizationService, IShortStringHelper shortStringHelper, HtmlImageSourceParser imageSourceParser, HtmlLocalLinkParser localLinkParser, RichTextEditorPastedImages pastedImages)
- : base(dataTypeService, localizationService,Current.Services.TextService, shortStringHelper, attribute)
+ public RichTextPropertyValueEditor(
+ DataEditorAttribute attribute,
+ IUmbracoContextAccessor umbracoContextAccessor,
+ IDataTypeService dataTypeService,
+ ILocalizationService localizationService,
+ ILocalizedTextService localizedTextService,
+ IShortStringHelper shortStringHelper,
+ HtmlImageSourceParser imageSourceParser,
+ HtmlLocalLinkParser localLinkParser,
+ RichTextEditorPastedImages pastedImages)
+ : base(dataTypeService, localizationService,localizedTextService, shortStringHelper, attribute)
{
_umbracoContextAccessor = umbracoContextAccessor;
_imageSourceParser = imageSourceParser;
diff --git a/src/Umbraco.Web/PropertyEditors/SliderPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/SliderPropertyEditor.cs
index c2be432247..6db7b284b8 100644
--- a/src/Umbraco.Web/PropertyEditors/SliderPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/SliderPropertyEditor.cs
@@ -3,6 +3,7 @@ using Umbraco.Web.Composing;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Services;
using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors
@@ -22,8 +23,14 @@ namespace Umbraco.Web.PropertyEditors
///
/// Initializes a new instance of the class.
///
- public SliderPropertyEditor(ILogger logger, IIOHelper ioHelper, IShortStringHelper shortStringHelper)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService, shortStringHelper)
+ public SliderPropertyEditor(
+ ILogger logger,
+ IIOHelper ioHelper,
+ IDataTypeService dataTypeService,
+ ILocalizationService localizationService,
+ ILocalizedTextService localizedTextService,
+ IShortStringHelper shortStringHelper)
+ : base(logger, dataTypeService, localizationService, localizedTextService, shortStringHelper)
{
_ioHelper = ioHelper;
}
diff --git a/src/Umbraco.Web/PropertyEditors/TagsPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/TagsPropertyEditor.cs
index 78c0b4f854..a80723e340 100644
--- a/src/Umbraco.Web/PropertyEditors/TagsPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/TagsPropertyEditor.cs
@@ -27,24 +27,29 @@ namespace Umbraco.Web.PropertyEditors
{
private readonly ManifestValueValidatorCollection _validators;
private readonly IIOHelper _ioHelper;
- private readonly ILocalizedTextService _localizedTextService;
- public TagsPropertyEditor(ManifestValueValidatorCollection validators, ILogger logger, IIOHelper ioHelper, ILocalizedTextService localizedTextService, IShortStringHelper shortStringHelper)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService, shortStringHelper)
+ public TagsPropertyEditor(
+ ManifestValueValidatorCollection validators,
+ ILogger logger,
+ IIOHelper ioHelper,
+ IDataTypeService dataTypeService,
+ ILocalizationService localizationService,
+ ILocalizedTextService localizedTextService,
+ IShortStringHelper shortStringHelper)
+ : base(logger, dataTypeService, localizationService, localizedTextService, shortStringHelper)
{
_validators = validators;
_ioHelper = ioHelper;
- _localizedTextService = localizedTextService;
}
- protected override IDataValueEditor CreateValueEditor() => new TagPropertyValueEditor(Current.Services.DataTypeService, Current.Services.LocalizationService, ShortStringHelper, Attribute);
+ protected override IDataValueEditor CreateValueEditor() => new TagPropertyValueEditor(DataTypeService, LocalizationService, LocalizedTextService, ShortStringHelper, Attribute);
- protected override IConfigurationEditor CreateConfigurationEditor() => new TagConfigurationEditor(_validators, _ioHelper, _localizedTextService);
+ protected override IConfigurationEditor CreateConfigurationEditor() => new TagConfigurationEditor(_validators, _ioHelper, LocalizedTextService);
internal class TagPropertyValueEditor : DataValueEditor
{
- public TagPropertyValueEditor(IDataTypeService dataTypeService, ILocalizationService localizationService, IShortStringHelper shortStringHelper, DataEditorAttribute attribute)
- : base(dataTypeService, localizationService,Current.Services.TextService, shortStringHelper, attribute)
+ public TagPropertyValueEditor(IDataTypeService dataTypeService, ILocalizationService localizationService, ILocalizedTextService localizedTextService, IShortStringHelper shortStringHelper, DataEditorAttribute attribute)
+ : base(dataTypeService, localizationService,localizedTextService, shortStringHelper, attribute)
{ }
///
diff --git a/src/Umbraco.Web/PropertyEditors/UploadFileTypeValidator.cs b/src/Umbraco.Web/PropertyEditors/UploadFileTypeValidator.cs
index 6855ab3bb8..39c2c0a2f6 100644
--- a/src/Umbraco.Web/PropertyEditors/UploadFileTypeValidator.cs
+++ b/src/Umbraco.Web/PropertyEditors/UploadFileTypeValidator.cs
@@ -14,6 +14,13 @@ namespace Umbraco.Web.PropertyEditors
{
internal class UploadFileTypeValidator : IValueValidator
{
+ private readonly ILocalizedTextService _localizedTextService;
+
+ public UploadFileTypeValidator(ILocalizedTextService localizedTextService)
+ {
+ _localizedTextService = localizedTextService;
+ }
+
public IEnumerable Validate(object value, string valueType, object dataTypeConfiguration)
{
string selectedFiles = null;
@@ -40,11 +47,11 @@ namespace Umbraco.Web.PropertyEditors
{
//we only store a single value for this editor so the 'member' or 'field'
// we'll associate this error with will simply be called 'value'
- yield return new ValidationResult(Current.Services.TextService.Localize("errors/dissallowedMediaType"), new[] { "value" });
+ yield return new ValidationResult(_localizedTextService.Localize("errors/dissallowedMediaType"), new[] { "value" });
}
}
}
-
+
internal static bool IsValidFileExtension(string fileName)
{
if (fileName.IndexOf('.') <= 0) return false;
diff --git a/src/Umbraco.Web/PropertyEditors/UserPickerPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/UserPickerPropertyEditor.cs
index cb95affa39..30568de0ea 100644
--- a/src/Umbraco.Web/PropertyEditors/UserPickerPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/UserPickerPropertyEditor.cs
@@ -2,6 +2,7 @@
using Umbraco.Web.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Services;
using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors
@@ -15,8 +16,13 @@ namespace Umbraco.Web.PropertyEditors
Icon = Constants.Icons.User)]
public class UserPickerPropertyEditor : DataEditor
{
- public UserPickerPropertyEditor(ILogger logger, IShortStringHelper shortStringHelper)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService, shortStringHelper)
+ public UserPickerPropertyEditor(
+ ILogger logger,
+ IDataTypeService dataTypeService,
+ ILocalizationService localizationService,
+ ILocalizedTextService localizedTextService,
+ IShortStringHelper shortStringHelper)
+ : base(logger, dataTypeService, localizationService, localizedTextService, shortStringHelper)
{ }
protected override IConfigurationEditor CreateConfigurationEditor() => new UserPickerConfiguration();
diff --git a/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs b/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs
index e07e94e3aa..4bef41f1eb 100755
--- a/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs
+++ b/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs
@@ -139,16 +139,16 @@ namespace Umbraco.Web.PublishedCache.NuCache
// figure out whether it can read the databases or it should populate them from sql
_logger.Info("Creating the content store, localContentDbExists? {LocalContentDbExists}", _localContentDbExists);
- _contentStore = new ContentStore(publishedSnapshotAccessor, variationContextAccessor, logger, Current.PublishedModelFactory, _localContentDb);
+ _contentStore = new ContentStore(publishedSnapshotAccessor, variationContextAccessor, logger, publishedModelFactory, _localContentDb);
_logger.Info("Creating the media store, localMediaDbExists? {LocalMediaDbExists}", _localMediaDbExists);
- _mediaStore = new ContentStore(publishedSnapshotAccessor, variationContextAccessor, logger, Current.PublishedModelFactory, _localMediaDb);
+ _mediaStore = new ContentStore(publishedSnapshotAccessor, variationContextAccessor, logger, publishedModelFactory, _localMediaDb);
}
else
{
_logger.Info("Creating the content store (local db ignored)");
- _contentStore = new ContentStore(publishedSnapshotAccessor, variationContextAccessor, logger, Current.PublishedModelFactory);
+ _contentStore = new ContentStore(publishedSnapshotAccessor, variationContextAccessor, logger, publishedModelFactory);
_logger.Info("Creating the media store (local db ignored)");
- _mediaStore = new ContentStore(publishedSnapshotAccessor, variationContextAccessor, logger, Current.PublishedModelFactory);
+ _mediaStore = new ContentStore(publishedSnapshotAccessor, variationContextAccessor, logger, publishedModelFactory);
}
_domainStore = new SnapDictionary();
diff --git a/src/Umbraco.Web/RoutableDocumentFilter.cs b/src/Umbraco.Web/RoutableDocumentFilter.cs
index badd351f13..6a8d2c295e 100644
--- a/src/Umbraco.Web/RoutableDocumentFilter.cs
+++ b/src/Umbraco.Web/RoutableDocumentFilter.cs
@@ -3,15 +3,13 @@ using System.IO;
using System.Web;
using System.Web.Routing;
using Umbraco.Core;
-using Umbraco.Core.Logging;
using Umbraco.Core.Configuration;
using System.Threading;
using System.Collections.Generic;
using System.Linq;
-using Umbraco.Core.IO;
using System.Collections.Concurrent;
using Umbraco.Core.Collections;
-using Umbraco.Core.Composing;
+using Umbraco.Web.Composing;
namespace Umbraco.Web
{
diff --git a/src/Umbraco.Web/Routing/DefaultMediaUrlProvider.cs b/src/Umbraco.Web/Routing/DefaultMediaUrlProvider.cs
index 89abde0576..beaf5f5864 100644
--- a/src/Umbraco.Web/Routing/DefaultMediaUrlProvider.cs
+++ b/src/Umbraco.Web/Routing/DefaultMediaUrlProvider.cs
@@ -17,11 +17,6 @@ namespace Umbraco.Web.Routing
_propertyEditors = propertyEditors ?? throw new ArgumentNullException(nameof(propertyEditors));
}
- [Obsolete("Use the constructor with all parameters instead")]
- public DefaultMediaUrlProvider() : this(Current.PropertyEditors)
- {
- }
-
///
public virtual UrlInfo GetMediaUrl(UmbracoContext umbracoContext, IPublishedContent content,
string propertyAlias, UrlMode mode, string culture, Uri current)
diff --git a/src/Umbraco.Web/Routing/PublishedRouter.cs b/src/Umbraco.Web/Routing/PublishedRouter.cs
index 30076ee2b0..8873c9ba12 100644
--- a/src/Umbraco.Web/Routing/PublishedRouter.cs
+++ b/src/Umbraco.Web/Routing/PublishedRouter.cs
@@ -4,7 +4,7 @@ using System.Threading;
using System.Globalization;
using System.IO;
using Umbraco.Core;
-using Umbraco.Core.Composing;
+using Umbraco.Web.Composing;
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
diff --git a/src/Umbraco.Web/Runtime/WebInitialComponent.cs b/src/Umbraco.Web/Runtime/WebInitialComponent.cs
index 0cf509400c..ea7b5b94e7 100644
--- a/src/Umbraco.Web/Runtime/WebInitialComponent.cs
+++ b/src/Umbraco.Web/Runtime/WebInitialComponent.cs
@@ -80,7 +80,7 @@ namespace Umbraco.Web.Runtime
ConfigureGlobalFilters();
// set routes
- CreateRoutes(_umbracoContextAccessor, _globalSettings, _shortStringHelper, _surfaceControllerTypes, _apiControllerTypes);
+ CreateRoutes(_umbracoContextAccessor, _globalSettings, _shortStringHelper, _surfaceControllerTypes, _apiControllerTypes, _ioHelper);
}
public void Terminate()
@@ -168,9 +168,10 @@ namespace Umbraco.Web.Runtime
IGlobalSettings globalSettings,
IShortStringHelper shortStringHelper,
SurfaceControllerTypeCollection surfaceControllerTypes,
- UmbracoApiControllerTypeCollection apiControllerTypes)
+ UmbracoApiControllerTypeCollection apiControllerTypes,
+ IIOHelper ioHelper)
{
- var umbracoPath = globalSettings.GetUmbracoMvcArea(Current.IOHelper);
+ var umbracoPath = globalSettings.GetUmbracoMvcArea(ioHelper);
// create the front-end route
var defaultRoute = RouteTable.Routes.MapRoute(
@@ -184,18 +185,19 @@ namespace Umbraco.Web.Runtime
RouteTable.Routes.RegisterArea();
// register all back office routes
- RouteTable.Routes.RegisterArea(new BackOfficeArea(globalSettings));
+ RouteTable.Routes.RegisterArea(new BackOfficeArea(globalSettings, ioHelper));
// plugin controllers must come first because the next route will catch many things
- RoutePluginControllers(globalSettings, surfaceControllerTypes, apiControllerTypes);
+ RoutePluginControllers(globalSettings, surfaceControllerTypes, apiControllerTypes, ioHelper);
}
private static void RoutePluginControllers(
IGlobalSettings globalSettings,
SurfaceControllerTypeCollection surfaceControllerTypes,
- UmbracoApiControllerTypeCollection apiControllerTypes)
+ UmbracoApiControllerTypeCollection apiControllerTypes,
+ IIOHelper ioHelper)
{
- var umbracoPath = globalSettings.GetUmbracoMvcArea(Current.IOHelper);
+ var umbracoPath = globalSettings.GetUmbracoMvcArea(ioHelper);
// need to find the plugin controllers and route them
var pluginControllers = surfaceControllerTypes.Concat(apiControllerTypes).ToArray();
@@ -217,7 +219,7 @@ namespace Umbraco.Web.Runtime
foreach (var g in groupedAreas)
{
// create & register an area for the controllers (this will throw an exception if all controllers are not in the same area)
- var pluginControllerArea = new PluginControllerArea(globalSettings, g.Select(PluginController.GetMetadata));
+ var pluginControllerArea = new PluginControllerArea(globalSettings, ioHelper, g.Select(PluginController.GetMetadata));
RouteTable.Routes.RegisterArea(pluginControllerArea);
}
}
diff --git a/src/Umbraco.Web/Runtime/WebRuntime.cs b/src/Umbraco.Web/Runtime/WebRuntime.cs
index 9de6c94638..a3411bdd5b 100644
--- a/src/Umbraco.Web/Runtime/WebRuntime.cs
+++ b/src/Umbraco.Web/Runtime/WebRuntime.cs
@@ -12,6 +12,7 @@ using Umbraco.Core.Runtime;
using Umbraco.Web.Cache;
using Umbraco.Web.Composing;
using Umbraco.Web.Logging;
+using Current = Umbraco.Web.Composing.Current;
namespace Umbraco.Web.Runtime
{
@@ -81,7 +82,7 @@ namespace Umbraco.Web.Runtime
NetworkHelper.MachineName);
Logger.Debug("Runtime: {Runtime}", GetType().FullName);
- var factory = base.Boot(register);
+ var factory = Current.Factory = base.Boot(register);
// now (and only now) is the time to switch over to perWebRequest scopes.
// up until that point we may not have a request, and scoped services would
diff --git a/src/Umbraco.Web/Search/ExamineComponent.cs b/src/Umbraco.Web/Search/ExamineComponent.cs
index 149b4d1436..ab5aa364a3 100644
--- a/src/Umbraco.Web/Search/ExamineComponent.cs
+++ b/src/Umbraco.Web/Search/ExamineComponent.cs
@@ -13,9 +13,8 @@ using Umbraco.Core.Services.Changes;
using Umbraco.Core.Sync;
using Umbraco.Web.Cache;
using Umbraco.Examine;
-using Umbraco.Core.Persistence.DatabaseModelDefinitions;
using Examine.LuceneEngine.Directories;
-using Umbraco.Core.Composing;
+using Umbraco.Web.Composing;
using System.ComponentModel;
namespace Umbraco.Web.Search
@@ -30,17 +29,17 @@ namespace Umbraco.Web.Search
private readonly BackgroundIndexRebuilder _backgroundIndexRebuilder;
private static object _isConfiguredLocker = new object();
private readonly IScopeProvider _scopeProvider;
- private readonly ServiceContext _services;
+ private readonly ServiceContext _services;
private readonly IMainDom _mainDom;
private readonly IProfilingLogger _logger;
private readonly IUmbracoIndexesCreator _indexCreator;
-
+
// the default enlist priority is 100
// enlist with a lower priority to ensure that anything "default" runs after us
// but greater that SafeXmlReaderWriter priority which is 60
private const int EnlistPriority = 80;
-
+
public ExamineComponent(IMainDom mainDom,
IExamineManager examineManager, IProfilingLogger profilingLogger,
IScopeProvider scopeProvider, IUmbracoIndexesCreator indexCreator,
@@ -706,6 +705,6 @@ namespace Umbraco.Web.Search
}
#endregion
-
+
}
}
diff --git a/src/Umbraco.Web/UmbracoApplicationBase.cs b/src/Umbraco.Web/UmbracoApplicationBase.cs
index 7f6d91cbed..44bae0fa91 100644
--- a/src/Umbraco.Web/UmbracoApplicationBase.cs
+++ b/src/Umbraco.Web/UmbracoApplicationBase.cs
@@ -113,7 +113,7 @@ namespace Umbraco.Web
// the boot manager is responsible for registrations
var register = GetRegister(globalSettings);
_runtime = GetRuntime(_configs, umbracoVersion, _ioHelper, _logger, _profiler, _hostingEnvironment, _backOfficeInfo);
- _factory = _runtime.Boot(register);
+ _factory =_runtime.Boot(register);
}
// called by ASP.NET (auto event wireup) once per app domain
diff --git a/src/Umbraco.Web/WebApi/Filters/FeatureAuthorizeAttribute.cs b/src/Umbraco.Web/WebApi/Filters/FeatureAuthorizeAttribute.cs
index d7bc311941..0cf23a31ca 100644
--- a/src/Umbraco.Web/WebApi/Filters/FeatureAuthorizeAttribute.cs
+++ b/src/Umbraco.Web/WebApi/Filters/FeatureAuthorizeAttribute.cs
@@ -1,6 +1,6 @@
using System.Web.Http;
using System.Web.Http.Controllers;
-using Umbraco.Core.Composing;
+using Umbraco.Web.Composing;
using Umbraco.Web.Features;
using Umbraco.Core;
diff --git a/src/Umbraco.Web/WebApi/HttpActionContextExtensions.cs b/src/Umbraco.Web/WebApi/HttpActionContextExtensions.cs
index 979e3d7892..9b337f57aa 100644
--- a/src/Umbraco.Web/WebApi/HttpActionContextExtensions.cs
+++ b/src/Umbraco.Web/WebApi/HttpActionContextExtensions.cs
@@ -6,9 +6,9 @@ using System.Threading.Tasks;
using System.Web.Http;
using System.Web.Http.Controllers;
using Newtonsoft.Json;
-using Umbraco.Core;
-using Umbraco.Core.Composing;
+using Umbraco.Web.Composing;
using Umbraco.Core.IO;
+using Umbraco.Core;
namespace Umbraco.Web.WebApi
{