Exemple #1
0
        protected DiContainer CreateEmptySubContainer()
        {
            var subContainer = _container.CreateSubContainer();

            SubContainerCreatorUtil.ApplyBindSettings(_containerBindInfo, subContainer);
            return(subContainer);
        }
        public DiContainer CreateSubContainer(List <TypeValuePair> args, InjectContext context, out Action injectAction)
        {
            var subContainer = _container.CreateSubContainer();

            SubContainerCreatorUtil.ApplyBindSettings(_containerBindInfo, subContainer);

            var extraArgs = UniDiPools.SpawnList <TypeValuePair>();

            extraArgs.AllocFreeAddRange(_extraArgs);
            extraArgs.AllocFreeAddRange(args);

            var installer = (InstallerBase)subContainer.InstantiateExplicit(
                _installerType, extraArgs);

            UniDiPools.DespawnList(extraArgs);

            installer.InstallBindings();

            injectAction = () =>
            {
                subContainer.ResolveRoots();
            };

            return(subContainer);
        }