diff --git a/VContainer/Assets/VContainer/Runtime/ContainerBuilder.cs b/VContainer/Assets/VContainer/Runtime/ContainerBuilder.cs index a344a001..731611c1 100644 --- a/VContainer/Assets/VContainer/Runtime/ContainerBuilder.cs +++ b/VContainer/Assets/VContainer/Runtime/ContainerBuilder.cs @@ -10,7 +10,6 @@ namespace VContainer public interface IContainerBuilder { object ApplicationOrigin { get; set; } - bool ContainerExposed { get; set; } RegistrationBuilder Register(Type type, Lifetime lifetime); RegistrationBuilder RegisterInstance(object instance); @@ -46,7 +45,6 @@ public IScopedObjectResolver BuildScope() public class ContainerBuilder : IContainerBuilder { public object ApplicationOrigin { get; set; } - public bool ContainerExposed { get; set; } readonly IList registrationBuilders = new List(); List> buildCallbacks; @@ -94,7 +92,7 @@ public virtual IObjectResolver Build() protected (IReadOnlyList, IReadOnlyList<(IRegistration, Action)>) BuildRegistrations() { - var registrations = new IRegistration[registrationBuilders.Count + (ContainerExposed ? 1 : 0)]; + var registrations = new IRegistration[registrationBuilders.Count + 1]; var callbacks = new List<(IRegistration, Action)>(registrations.Length); #if VCONTAINER_PARALLEL_CONTAINER_BUILD @@ -122,10 +120,7 @@ public virtual IObjectResolver Build() } } #endif - if (ContainerExposed) - { - registrations[registrations.Length - 1] = ContainerRegistration.Default; - } + registrations[registrations.Length - 1] = ContainerRegistration.Default; #if VCONTAINER_PARALLEL_CONTAINER_BUILD Parallel.For(0, registrations.Count, i => diff --git a/VContainer/Assets/VContainer/Runtime/ContainerBuilderExtensions.cs b/VContainer/Assets/VContainer/Runtime/ContainerBuilderExtensions.cs index 3b1e96ba..62cf0b13 100644 --- a/VContainer/Assets/VContainer/Runtime/ContainerBuilderExtensions.cs +++ b/VContainer/Assets/VContainer/Runtime/ContainerBuilderExtensions.cs @@ -117,7 +117,9 @@ public static RegistrationBuilder RegisterFactory builder.ContainerExposed = true; + { + } } } diff --git a/VContainer/Assets/VContainer/Runtime/Unity/LifetimeScope.cs b/VContainer/Assets/VContainer/Runtime/Unity/LifetimeScope.cs index cfda24da..a0b9d3dc 100644 --- a/VContainer/Assets/VContainer/Runtime/Unity/LifetimeScope.cs +++ b/VContainer/Assets/VContainer/Runtime/Unity/LifetimeScope.cs @@ -236,7 +236,6 @@ void InstallTo(IContainerBuilder builder) extraInstallerStatic?.Install(builder); builder.RegisterInstance(this).AsSelf(); - builder.RegisterContainer(); } LifetimeScope GetRuntimeParent()