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

@@ -116,9 +116,8 @@ namespace Umbraco.Extensions
Assembly entryAssembly,
AppCaches appCaches,
ILoggingConfiguration loggingConfiguration,
IConfiguration configuration,
out IFactory factory)
=> services.AddUmbracoCore(webHostEnvironment, umbContainer, entryAssembly, appCaches, loggingConfiguration, configuration, GetCoreRuntime, out factory);
IConfiguration configuration)
=> services.AddUmbracoCore(webHostEnvironment, umbContainer, entryAssembly, appCaches, loggingConfiguration, configuration, GetCoreRuntime);
/// <summary>
/// Adds the Umbraco Configuration requirements
@@ -160,18 +159,6 @@ namespace Umbraco.Extensions
return services;
}
/// <summary>
/// Adds the Umbraco Back Core requirements
/// </summary>
/// <param name="services"></param>
/// <param name="webHostEnvironment"></param>
/// <param name="configuration"></param>
/// <returns></returns>
public static IServiceCollection AddUmbracoCore(this IServiceCollection services, IWebHostEnvironment webHostEnvironment, IConfiguration configuration)
{
return services.AddUmbracoCore(webHostEnvironment, configuration, out _);
}
/// <summary>
/// Adds the Umbraco Back Core requirements
/// </summary>
@@ -180,7 +167,7 @@ namespace Umbraco.Extensions
/// <param name="configuration"></param>
/// <param name="factory"></param>
/// <returns></returns>
public static IServiceCollection AddUmbracoCore(this IServiceCollection services, IWebHostEnvironment webHostEnvironment, IConfiguration configuration, out IFactory factory)
public static IServiceCollection AddUmbracoCore(this IServiceCollection services, IWebHostEnvironment webHostEnvironment, IConfiguration configuration)
{
var loggingConfig = new LoggingConfiguration(
@@ -209,8 +196,7 @@ namespace Umbraco.Extensions
appCaches,
loggingConfig,
configuration,
GetCoreRuntime,
out factory);
GetCoreRuntime);
return services;
}
@@ -237,8 +223,7 @@ namespace Umbraco.Extensions
ILoggingConfiguration loggingConfiguration,
IConfiguration configuration,
//TODO: Yep that's extremely ugly
Func<GlobalSettings, ConnectionStrings, IUmbracoVersion, IIOHelper, ILoggerFactory, IProfiler, IHostingEnvironment, IBackOfficeInfo, ITypeFinder, AppCaches, IDbProviderFactoryCreator, IRuntime> getRuntime,
out IFactory factory)
Func<GlobalSettings, ConnectionStrings, IUmbracoVersion, IIOHelper, ILoggerFactory, IProfiler, IHostingEnvironment, IBackOfficeInfo, ITypeFinder, AppCaches, IDbProviderFactoryCreator, IRuntime> getRuntime)
{
if (services is null) throw new ArgumentNullException(nameof(services));
var container = umbContainer;
@@ -306,7 +291,7 @@ namespace Umbraco.Extensions
appCaches,
dbProviderFactoryCreator);
factory = coreRuntime.Configure(container);
coreRuntime.Configure(services);
return services;
}