public override void Register(IComponentRegistration registration, bool preserveDefaults)
        {
            var toRegister = registration;

            if (registration.Lifetime is RootScopeLifetime)
                toRegister = new ComponentRegistrationLifetimeDecorator(registration, _restrictedRootScopeLifetime);

            base.Register(toRegister, preserveDefaults);
        }
Example #2
0
        public override void Register(IComponentRegistration registration, bool preserveDefaults)
        {
            IComponentRegistration registration2 = registration;

            if (registration.Lifetime is RootScopeLifetime)
            {
                registration2 = new ComponentRegistrationLifetimeDecorator(registration, this._restrictedRootScopeLifetime);
            }
            base.Register(registration2, preserveDefaults);
        }
Example #3
0
        public override void Register(IComponentRegistration registration, bool preserveDefaults)
        {
            var toRegister = registration;

            if (registration.Lifetime is RootScopeLifetime)
            {
                toRegister = new ComponentRegistrationLifetimeDecorator(registration, _restrictedRootScopeLifetime);
            }

            base.Register(toRegister, preserveDefaults);
        }
        public override void Register(IComponentRegistration registration, bool preserveDefaults)
        {
            if (registration == null) throw new ArgumentNullException(nameof(registration));

            var toRegister = registration;

            if (registration.Lifetime is RootScopeLifetime)
                toRegister = new ComponentRegistrationLifetimeDecorator(registration, _restrictedRootScopeLifetime);

            base.Register(toRegister, preserveDefaults);
        }
Example #5
0
        public override void Register(IComponentRegistration registration, bool preserveDefaults)
        {
            if (registration == null)
            {
                throw new ArgumentNullException("registration");
            }
            var toRegister = registration;

            if (registration.Lifetime is RootScopeLifetime)
            {
                toRegister = new ComponentRegistrationLifetimeDecorator(registration, _restrictedRootScopeLifetime);
            }

            base.Register(toRegister, preserveDefaults);
        }
Example #6
0
        protected override void AddRegistration(IComponentRegistration registration, bool preserveDefaults, bool originatedFromSource = false)
        {
            if (registration == null)
            {
                throw new ArgumentNullException(nameof(registration));
            }

            var toRegister = registration;

            if (registration.Lifetime is RootScopeLifetime)
            {
                toRegister = new ComponentRegistrationLifetimeDecorator(registration, _restrictedRootScopeLifetime);
            }

            base.AddRegistration(toRegister, preserveDefaults, originatedFromSource);
        }
        /// <inheritdoc/>
        public override void AddRegistration(IComponentRegistration registration, bool preserveDefaults, bool originatedFromSource = false)
        {
            if (registration == null)
            {
                throw new ArgumentNullException(nameof(registration));
            }

            var toRegister = registration;

            if (registration.Lifetime is RootScopeLifetime && !(registration is ExternalComponentRegistration))
            {
#pragma warning disable CA2000 // Dispose objects before losing scope
                toRegister = new ComponentRegistrationLifetimeDecorator(registration, _restrictedRootScopeLifetime);
#pragma warning restore CA2000 // Dispose objects before losing scope
            }

            base.AddRegistration(toRegister, preserveDefaults, originatedFromSource);
        }