Beispiel #1
0
        private void AddContainerRegistrations()
        {
            // Add the default registrations. This adds them as registration, but only in case some component
            // starts depending on them.
            var scopeLifestyle = new ScopedScopeLifestyle();

            this.resolveUnregisteredTypeRegistrations[typeof(Scope)] = new Lazy <InstanceProducer>(
                () => scopeLifestyle.CreateProducer(() => scopeLifestyle.GetCurrentScope(this), this));

            this.resolveUnregisteredTypeRegistrations[typeof(Container)] = new Lazy <InstanceProducer>(
                () => Lifestyle.Singleton.CreateProducer(() => this, this));
        }
Beispiel #2
0
        internal UnregisteredTypeResolutionInstanceProducerBuilder(
            Container container,
            Func <bool> shouldResolveUnregisteredTypes,
            Action <UnregisteredTypeEventArgs> resolveUnregisteredType)
        {
            this.container = container;
            this.shouldResolveUnregisteredTypes = shouldResolveUnregisteredTypes;
            this.resolveUnregisteredType        = resolveUnregisteredType;

            // Add the default registrations. This adds them as registration, but only in case some component
            // starts depending on them.
            var scopeLifestyle = new ScopedScopeLifestyle();

            this.resolveUnregisteredTypeRegistrations[typeof(Scope)] = new LazyEx <InstanceProducer>(
                () => scopeLifestyle.CreateProducer(() => scopeLifestyle.GetCurrentScope(container), container));

            this.resolveUnregisteredTypeRegistrations[typeof(Container)] = new LazyEx <InstanceProducer>(
                () => Lifestyle.Singleton.CreateProducer(() => container, container));
        }