NetCore: MSDI refactor phase 2 (#9280)

* Moved adapters from Infra -> Core

* Allow Composition to accept a service collection instead of an IRegister

* Composition no longer takes IRegister as constructor arg

all tests passing

* Composition no longer implements IRegister

* Lose _uniques in Composition

* lose Composition OnCreatingFactory actions

* Clean up UmbracoCoreServiceCollectionExtensions & Composition

Less IFactory

* LightInject gone where TFW == netstandard2.0 || TFW == netcoreapp3.1

* Resolve dead code issues

* Rename IFactory methods to match IServiceProvider so they can be trivially swapped later.

* Rename IFactory methods to match IServiceProvider so they can be trivially swapped later (continued)

Thought the counts were low, it's mostly extension method usage
This commit is contained in:
Paul Johnson
2020-10-27 10:53:01 +00:00
committed by GitHub
parent 507facbdaa
commit ec66990e72
111 changed files with 662 additions and 1998 deletions

View File

@@ -1,4 +1,5 @@
using Umbraco.Core;
using Microsoft.Extensions.DependencyInjection;
using Umbraco.Core;
using Umbraco.Core.BackOffice;
using Umbraco.Core.Composing;
using Umbraco.Core.Mapping;
@@ -15,7 +16,7 @@ namespace Umbraco.Extensions
.Add<MediaMapDefinition>()
.Add<MemberMapDefinition>();
composition.Register<CommonTreeNodeMapper>();
composition.Services.AddTransient<CommonTreeNodeMapper>();
return composition;
}

View File

@@ -1,4 +1,5 @@
using System.Linq;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Umbraco.Core;
using Umbraco.Core.Composing;
@@ -26,8 +27,8 @@ namespace Umbraco.Web.BackOffice.Runtime
composition.RegisterUnique<BackOfficeAreaRoutes>();
composition.RegisterUnique<PreviewRoutes>();
composition.RegisterUnique<BackOfficeServerVariables>();
composition.Register<BackOfficeSessionIdValidator>(Lifetime.Request);
composition.Register<BackOfficeSecurityStampValidator>(Lifetime.Request);
composition.Services.AddScoped<BackOfficeSessionIdValidator>();
composition.Services.AddScoped<BackOfficeSecurityStampValidator>();
composition.RegisterUnique<PreviewAuthenticationMiddleware>();
composition.RegisterUnique<IBackOfficeAntiforgery, BackOfficeAntiforgery>();
@@ -43,9 +44,9 @@ namespace Umbraco.Web.BackOffice.Runtime
composition.RegisterUnique<IPhysicalFileSystem>(factory =>
new PhysicalFileSystem(
factory.GetInstance<IIOHelper>(),
factory.GetInstance<IHostingEnvironment>(),
factory.GetInstance<ILogger<PhysicalFileSystem>>(),
factory.GetRequiredService<IIOHelper>(),
factory.GetRequiredService<IHostingEnvironment>(),
factory.GetRequiredService<ILogger<PhysicalFileSystem>>(),
"~/"));
composition.RegisterUnique<IIconService, IconService>();