Moves most service interfaces, ensure IOHelper is registered

This commit is contained in:
Shannon
2019-11-12 16:31:08 +11:00
parent 40f1a1f6ea
commit 2b2db8b8ef
18 changed files with 184 additions and 168 deletions

View File

@@ -42,6 +42,11 @@ namespace Umbraco.Core.Runtime
/// </summary>
protected IProfilingLogger ProfilingLogger { get; private set; }
/// <summary>
/// Gets the <see cref="IIOHelper"/>
/// </summary>
protected IIOHelper IOHelper { get; private set; }
/// <inheritdoc />
public IRuntimeState State => _state;
@@ -56,6 +61,10 @@ namespace Umbraco.Core.Runtime
var profiler = Profiler = GetProfiler();
var profilingLogger = ProfilingLogger = new ProfilingLogger(logger, profiler);
IOHelper = GetIOHelper();
if (IOHelper == null)
throw new InvalidOperationException($"The object returned from {nameof(GetIOHelper)} cannot be null");
// the boot loader boots using a container scope, so anything that is PerScope will
// be disposed after the boot loader has booted, and anything else will remain.
// note that this REQUIRES that perWebRequestScope has NOT been enabled yet, else
@@ -130,7 +139,7 @@ namespace Umbraco.Core.Runtime
// create the composition
composition = new Composition(register, typeLoader, ProfilingLogger, _state, configs);
composition.RegisterEssentials(Logger, Profiler, ProfilingLogger, mainDom, appCaches, databaseFactory, typeLoader, _state);
composition.RegisterEssentials(Logger, Profiler, ProfilingLogger, mainDom, appCaches, databaseFactory, typeLoader, _state, IOHelper);
// run handlers
RuntimeOptions.DoRuntimeEssentials(composition, appCaches, typeLoader, databaseFactory);
@@ -313,6 +322,13 @@ namespace Umbraco.Core.Runtime
protected virtual IProfiler GetProfiler()
=> new LogProfiler(Logger);
/// <summary>
/// Gets a <see cref="IIOHelper"/>
/// </summary>
/// <returns></returns>
protected virtual IIOHelper GetIOHelper()
=> new Umbraco.Core.IO.IOHelper();
/// <summary>
/// Gets the application caches.
/// </summary>