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)
67
67
{
68
68
return sharedInstances . GetOrAdd ( registration , createInstance ) . Value ;
69
69
}
70
- return Parent . Resolve ( registration ) ;
70
+ return ( Parent . Parent is null ? Parent . Root : Parent ) . Resolve ( registration ) ;
71
71
72
72
case Lifetime . Scoped :
73
73
var lazy = sharedInstances . GetOrAdd ( registration , createInstance ) ;
Original file line number Diff line number Diff line change @@ -120,10 +120,12 @@ public void CreateScopeWithRegisterSingleton()
120
120
{
121
121
var parentSingleton = grandChildContainer . Resolve < NoDependencyServiceA > ( ) ;
122
122
Assert . That ( parentSingleton , Is . InstanceOf < NoDependencyServiceA > ( ) ) ;
123
+ Assert . That ( parentSingleton , Is . EqualTo ( parentContainer . Resolve < NoDependencyServiceA > ( ) ) ) ;
123
124
124
125
var childSingleton = grandChildContainer . Resolve < ServiceA > ( ) ;
125
126
Assert . That ( childSingleton , Is . InstanceOf < ServiceA > ( ) ) ;
126
127
Assert . That ( childSingleton . Service2 , Is . InstanceOf < I2 > ( ) ) ;
128
+ Assert . That ( childSingleton , Is . EqualTo ( childContainer . Resolve < ServiceA > ( ) ) ) ;
127
129
128
130
var grandChildSingleton = grandChildContainer . Resolve < ServiceB > ( ) ;
129
131
Assert . That ( grandChildSingleton , Is . InstanceOf < ServiceB > ( ) ) ;
You can’t perform that action at this time.
0 commit comments