Remove RegisterOrdered requirement from IContainer

This commit is contained in:
Stephan
2018-11-19 15:10:35 +01:00
parent 199e09c789
commit b69cbf0c53
4 changed files with 37 additions and 32 deletions

View File

@@ -116,12 +116,6 @@ namespace Umbraco.Core.Composing
/// </remarks>
void RegisterAuto(Type serviceBaseType);
/// <summary>
/// Registers a service with an ordered set of implementation types.
/// </summary>
// fixme: once we merge the installer refactoring, kill that one
void RegisterOrdered(Type serviceType, Type[] implementingTypes, Lifetime lifetime = Lifetime.Transient);
#endregion
#region Control

View File

@@ -230,10 +230,6 @@ namespace Umbraco.Core.Composing.LightInject
}, null);
}
/// <inheritdoc />
public void RegisterOrdered(Type serviceType, Type[] implementingTypes, Lifetime lifetime = Lifetime.Transient)
=> Container.RegisterOrdered(serviceType, implementingTypes, _ => GetLifetime(lifetime));
// was the Light-Inject specific way of dealing with args, but we've replaced it with our own
// beware! does NOT work on singletons, see https://github.com/seesharper/LightInject/issues/294
//

View File

@@ -1,8 +1,6 @@
using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.Composing;
using Umbraco.Web.Install;
using Umbraco.Web.Install.InstallSteps;
using Umbraco.Web.Install.Models;
namespace Umbraco.Web.Composing.Composers
{
@@ -10,25 +8,22 @@ namespace Umbraco.Web.Composing.Composers
{
public static IContainer ComposeInstaller(this IContainer container)
{
//register the installer steps in order
container.RegisterOrdered(typeof(InstallSetupStep),
new[]
{
typeof(NewInstallStep),
typeof(UpgradeStep),
typeof(FilePermissionsStep),
typeof(ConfigureMachineKey),
typeof(DatabaseConfigureStep),
typeof(DatabaseInstallStep),
typeof(DatabaseUpgradeStep),
// register the installer steps
//TODO: Add these back once we have a compatible starter kit
//typeof(StarterKitDownloadStep),
//typeof(StarterKitInstallStep),
//typeof(StarterKitCleanupStep),
container.Register<NewInstallStep>(Lifetime.Scope);
container.Register<UpgradeStep>(Lifetime.Scope);
container.Register<FilePermissionsStep>(Lifetime.Scope);
container.Register<ConfigureMachineKey>(Lifetime.Scope);
container.Register<DatabaseConfigureStep>(Lifetime.Scope);
container.Register<DatabaseInstallStep>(Lifetime.Scope);
container.Register<DatabaseUpgradeStep>(Lifetime.Scope);
typeof(SetUmbracoVersionStep)
}, Lifetime.Scope);
//TODO: Add these back once we have a compatible starter kit
//container.Register<StarterKitDownloadStep>(Lifetime.Scope);
//container.Register<StarterKitInstallStep>(Lifetime.Scope);
//container.Register<StarterKitCleanupStep>(Lifetime.Scope);
container.Register<SetUmbracoVersionStep>(Lifetime.Scope);
container.Register<InstallStepCollection>();
container.Register<InstallHelper>();

View File

@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using Umbraco.Web.Install.InstallSteps;
using Umbraco.Web.Install.Models;
namespace Umbraco.Web.Install
@@ -9,10 +10,29 @@ namespace Umbraco.Web.Install
private readonly InstallHelper _installHelper;
private readonly IEnumerable<InstallSetupStep> _orderedInstallerSteps;
public InstallStepCollection(InstallHelper installHelper, IEnumerable<InstallSetupStep> orderedInstallerSteps)
public InstallStepCollection(InstallHelper installHelper, IEnumerable<InstallSetupStep> installerSteps)
{
_installHelper = installHelper;
_orderedInstallerSteps = orderedInstallerSteps;
// fixme this is ugly but I have a branch where it's nicely refactored - for now we just want to manage ordering
var a = installerSteps.ToArray();
_orderedInstallerSteps = new InstallSetupStep[]
{
a.OfType<NewInstallStep>().First(),
a.OfType<UpgradeStep>().First(),
a.OfType<FilePermissionsStep>().First(),
a.OfType<ConfigureMachineKey>().First(),
a.OfType<DatabaseConfigureStep>().First(),
a.OfType<DatabaseInstallStep>().First(),
a.OfType<DatabaseUpgradeStep>().First(),
//TODO: Add these back once we have a compatible starter kit
//orderedInstallerSteps.OfType<StarterKitDownloadStep>().First(),
//orderedInstallerSteps.OfType<StarterKitInstallStep>().First(),
//orderedInstallerSteps.OfType<StarterKitCleanupStep>().First(),
a.OfType<SetUmbracoVersionStep>().First(),
};
}