internal ScopedContainerBuilder( IObjectResolver root, IScopedObjectResolver parent) { this.root = root; this.parent = parent; }
internal Container(IRegistry registry) { this.registry = registry; rootScope = new ScopedContainer(registry, this); createInstance = registration => { return(new Lazy <object>(() => registration.SpawnInstance(this))); }; }
internal ScopedContainer( IRegistry registry, IObjectResolver root, IScopedObjectResolver parent = null) { this.registry = registry; Root = root; Parent = parent; createInstance = registration => { return(new Lazy <object>(() => registration.SpawnInstance(this))); }; }
IRegistration FindRegistration(Type type) { IScopedObjectResolver scope = this; while (scope != null) { if (scope.TryGetRegistration(type, out var registration)) { return(registration); } scope = scope.Parent; } throw new VContainerException(type, $"No such registration of type: {type.FullName}"); }