public QuickInjectContainer()
        {
            this.extensionImpl = new ExtensionImpl(this, new DummyPolicyList());

            this.factoryExpressionTable.Add(UnityContainerType, Expression.Constant(this));

            this.Registering += delegate { };
            this.RegisteringInstance += delegate { };
            this.ChildContainerCreated += delegate { };
        }
Пример #2
0
        public QuickInjectContainer()
        {
            this.extensionImpl = new ExtensionImpl(this);

            this.factoryExpressionTable.Add(UnityContainerType, Expression.Constant(this));

            this.Registering           += delegate { };
            this.RegisteringInstance   += delegate { };
            this.ChildContainerCreated += delegate { };
        }
Пример #3
0
        public IQuickInjectContainer CreateChildContainer()
        {
            QuickInjectContainer child;
            ExtensionImpl        childContext;

            // The child container collection and build plan visitor collection are enumerated during ClearBuildPlans and child container
            // instantiation, so we must synchronize to avoid modifying the collections during enumeration.
            lock (this.lockObj)
            {
                child        = new QuickInjectContainer(this);
                childContext = new ExtensionImpl(child);
                this.children.Add(child);
            }

            // Must happen outside the lock to avoid deadlock between callers
            this.ChildContainerCreated(this, new ChildContainerCreatedEventArgs(childContext));

            return(child);
        }
        private QuickInjectContainer(QuickInjectContainer parent)
        {
            if (parent == null)
            {
                throw new ArgumentNullException("parent");
            }

            this.Registering += delegate { };
            this.RegisteringInstance += delegate { };
            this.ChildContainerCreated += delegate { };

            this.RegisterDependencyTreeListener(parent.dependencyTreeListener);
            foreach (var visitor in parent.buildPlanVisitors)
            {
                this.AddBuildPlanVisitor(visitor);
            }

            this.parentContainer = parent;
            this.extensionImpl = this.parentContainer.extensionImpl;

            this.factoryExpressionTable.Add(UnityContainerType, Expression.Constant(this));
        }
Пример #5
0
        private QuickInjectContainer(QuickInjectContainer parent)
        {
            if (parent == null)
            {
                throw new ArgumentNullException("parent");
            }

            this.Registering           += delegate { };
            this.RegisteringInstance   += delegate { };
            this.ChildContainerCreated += delegate { };

            this.RegisterDependencyTreeListener(parent.dependencyTreeListener);
            foreach (var visitor in parent.buildPlanVisitors)
            {
                this.AddBuildPlanVisitor(visitor);
            }

            this.parentContainer = parent;
            this.extensionImpl   = this.parentContainer.extensionImpl;

            this.factoryExpressionTable.Add(UnityContainerType, Expression.Constant(this));
        }
        public IUnityContainer CreateChildContainer()
        {
            QuickInjectContainer child;
            ExtensionImpl childContext;

            lock (this.lockObj)
            {
                child = new QuickInjectContainer(this);
                childContext = new ExtensionImpl(child, new DummyPolicyList());
                this.children.Add(child);
            }

            // Must happen outside the lock to avoid deadlock between callers
            this.ChildContainerCreated(this, new ChildContainerCreatedEventArgs(childContext));

            return child;
        }