public DiContainer CreateSubContainer(List <TypeValuePair> args, InjectContext context)
        {
            // We can't really support arguments if we are using the cached value since
            // the arguments might change when called after the first time
            Assert.IsEmpty(args);

#if ZEN_MULTITHREADING
            lock (_locker)
#endif
            {
                if (_subContainer == null)
                {
#if !ZEN_MULTITHREADING
                    Assert.That(!_isLookingUp,
                                "Found unresolvable circular dependency when looking up sub container!  Object graph:\n {0}", context.GetObjectGraphString());
                    _isLookingUp = true;
#endif

                    _subContainer = _subCreator.CreateSubContainer(new List <TypeValuePair>(), context);

#if !ZEN_MULTITHREADING
                    _isLookingUp = false;
#endif

                    Assert.IsNotNull(_subContainer);
                }

                return(_subContainer);
            }
        }
        public IEnumerator <List <object> > GetAllInstancesWithInjectSplit(InjectContext context, List <TypeValuePair> args)
        {
            Assert.IsNotNull(context);

            var subContainer = _subContainerCreator.CreateSubContainer(args);

            var subContext = CreateSubContext(context, subContainer);

            yield return(subContainer.ResolveAll(subContext).Cast <object>().ToList());
        }
        public DiContainer CreateSubContainer(List <TypeValuePair> args)
        {
            // We can't really support arguments if we are using the cached value since
            // the arguments might change when called after the first time
            Assert.IsEmpty(args);

            if (_subContainer == null)
            {
                _subContainer = _subCreator.CreateSubContainer(new List <TypeValuePair>());
                Assert.IsNotNull(_subContainer);
            }

            return(_subContainer);
        }
Ejemplo n.º 4
0
        public void GetAllInstancesWithInjectSplit(
            InjectContext context, List <TypeValuePair> args, out Action injectAction, List <object> buffer)
        {
            Assert.IsNotNull(context);

            var subContainer = _subContainerCreator.CreateSubContainer(args, context, out injectAction);

            var subContext = CreateSubContext(context, subContainer);

            if (_resolveAll)
            {
                subContainer.ResolveAll(subContext, buffer);
                return;
            }

            buffer.Add(subContainer.Resolve(subContext));
        }
Ejemplo n.º 5
0
        public List <object> GetAllInstancesWithInjectSplit(
            InjectContext context, List <TypeValuePair> args, out Action injectAction)
        {
            Assert.IsNotNull(context);

            var subContainer = _subContainerCreator.CreateSubContainer(args, context);

            var subContext = CreateSubContext(context, subContainer);

            injectAction = null;

            if (_resolveAll)
            {
                return(subContainer.ResolveAll(subContext).Cast <object>().ToList());
            }

            return(new List <object>()
            {
                subContainer.Resolve(subContext),
            });
        }