File tree Expand file tree Collapse file tree 2 files changed +3
-1
lines changed
VContainer/Assets/VContainer Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ public object Resolve(IRegistration registration)
6767 {
6868 return sharedInstances . GetOrAdd ( registration , createInstance ) . Value ;
6969 }
70- return Parent . Resolve ( registration ) ;
70+ return ( Parent . Parent is null ? Parent . Root : Parent ) . Resolve ( registration ) ;
7171
7272 case Lifetime . Scoped :
7373 var lazy = sharedInstances . GetOrAdd ( registration , createInstance ) ;
Original file line number Diff line number Diff line change @@ -120,10 +120,12 @@ public void CreateScopeWithRegisterSingleton()
120120 {
121121 var parentSingleton = grandChildContainer . Resolve < NoDependencyServiceA > ( ) ;
122122 Assert . That ( parentSingleton , Is . InstanceOf < NoDependencyServiceA > ( ) ) ;
123+ Assert . That ( parentSingleton , Is . EqualTo ( parentContainer . Resolve < NoDependencyServiceA > ( ) ) ) ;
123124
124125 var childSingleton = grandChildContainer . Resolve < ServiceA > ( ) ;
125126 Assert . That ( childSingleton , Is . InstanceOf < ServiceA > ( ) ) ;
126127 Assert . That ( childSingleton . Service2 , Is . InstanceOf < I2 > ( ) ) ;
128+ Assert . That ( childSingleton , Is . EqualTo ( childContainer . Resolve < ServiceA > ( ) ) ) ;
127129
128130 var grandChildSingleton = grandChildContainer . Resolve < ServiceB > ( ) ;
129131 Assert . That ( grandChildSingleton , Is . InstanceOf < ServiceB > ( ) ) ;
You can’t perform that action at this time.
0 commit comments