From 07100a8fc6989ed2ee968e083640a25758dd63dd Mon Sep 17 00:00:00 2001 From: Steve Vermeulen Date: Sun, 7 Oct 2018 10:33:42 +0800 Subject: [PATCH] Changed FromComponentsInHierarchy to require scope set --- .../TestFromComponentInHierarchy.cs | 8 ++++---- .../Source/Binding/Binders/FromBinders/FromBinder.cs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/UnityProject/Assets/Plugins/Zenject/OptionalExtras/IntegrationTests/Tests/Bindings/TestFromComponentInHierarchy/TestFromComponentInHierarchy.cs b/UnityProject/Assets/Plugins/Zenject/OptionalExtras/IntegrationTests/Tests/Bindings/TestFromComponentInHierarchy/TestFromComponentInHierarchy.cs index d6c7931e3..2756e6374 100644 --- a/UnityProject/Assets/Plugins/Zenject/OptionalExtras/IntegrationTests/Tests/Bindings/TestFromComponentInHierarchy/TestFromComponentInHierarchy.cs +++ b/UnityProject/Assets/Plugins/Zenject/OptionalExtras/IntegrationTests/Tests/Bindings/TestFromComponentInHierarchy/TestFromComponentInHierarchy.cs @@ -58,7 +58,7 @@ public IEnumerator RunMatchMultiple() Setup1(); PreInstall(); Container.Bind().AsSingle(); - Container.Bind().FromComponentsInHierarchy(); + Container.Bind().FromComponentsInHierarchy().AsCached(); PostInstall(); @@ -88,7 +88,7 @@ public IEnumerator RunMatchNotFoundSuccess() PreInstall(); Container.Bind().AsSingle().NonLazy(); - Container.Bind().FromComponentsInHierarchy(); + Container.Bind().FromComponentsInHierarchy().AsCached(); PostInstall(); @@ -134,7 +134,7 @@ public IEnumerator RunMatchMultipleNonGeneric() Setup1(); PreInstall(); Container.Bind().AsSingle(); - Container.Bind(typeof(Foo)).FromComponentsInHierarchy(); + Container.Bind(typeof(Foo)).FromComponentsInHierarchy().AsCached(); PostInstall(); @@ -164,7 +164,7 @@ public IEnumerator RunMatchNotFoundSuccessNonGeneric() PreInstall(); Container.Bind().AsSingle().NonLazy(); - Container.Bind(typeof(Foo)).FromComponentsInHierarchy(); + Container.Bind(typeof(Foo)).FromComponentsInHierarchy().AsCached(); PostInstall(); diff --git a/UnityProject/Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders/FromBinder.cs b/UnityProject/Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders/FromBinder.cs index c5ccd1d66..8af2e64b6 100644 --- a/UnityProject/Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders/FromBinder.cs +++ b/UnityProject/Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders/FromBinder.cs @@ -747,7 +747,7 @@ protected ScopeConcreteIdArgConditionCopyNonLazyBinder FromComponentsInHierarchy { BindingUtil.AssertIsInterfaceOrComponent(AllParentTypes); - BindInfo.RequireExplicitScope = false; + BindInfo.RequireExplicitScope = true; // Don't know how it's created so can't assume here that it violates AsSingle BindInfo.MarkAsCreationBinding = false;