Пример #1
0
        public IConfigurableRegistration SetLifetime(ILifetime lifetime)
        {
            // Currently allows changing lifetime no matter if compiled or not and/or used in other compiled registrations
            // The change wont be reflected if changed after it have been compiled (and not re-compiled) which is a problem.
            // Throw an exception ? or just  dont care ? or recompile (if already compiled - requires all registrations to be recompiled as they might refer to this registration)

            if (lifetime == null)
                throw new ArgumentNullException("lifetime");

            // Init new lifetime
            lifetime.Init(this);

            // If _lifetime is already set dispose it first ? or call Clear/Reset() if supported ?
            //if (_lifetime != null)
            //   _lifetime.Dispose();

            _lifetime = lifetime;

            return this;
        }