void MakeRegistrationAndResultAvailableToSubsequentResolutions(IServiceRegistration registration,
                                                                       ResolutionResult result)
        {
            if (result == null || !result.IsSuccess)
            {
                return;
            }

            registry.Add(registration);

            if (cache != null)
            {
                cache.Add(registration, result.ResolvedObject);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Adds a collection of registration instances directly.
        /// </summary>
        /// <param name="registrations">A collection of registrations.</param>
        public void AddRegistrations(IEnumerable <IServiceRegistration> registrations)
        {
            if (registrations == null)
            {
                throw new ArgumentNullException(nameof(registrations));
            }

            AssertNotDisposed();

            foreach (var registration in registrations)
            {
                DoNotPermitReRegisteringAServiceWhichIsAlreadyCached(registration);
                registry.Add(registration);
            }
        }