Exemplo n.º 1
0
        /// <summary>
        /// Iterates through all the <see cref="ServiceRegistration"/> instances within
        /// <paramref name="registrationList"/> and process them with the registered
        /// <see cref="IAutoRegistrator"/> instance or uses <see cref="DefaultAutoRegistrator"/>
        /// if one is not registered.
        /// </summary>
        /// <param name="registrationList">Registrations to process</param>
        protected virtual void ProcessAutomaticRegistration(AutoRegistrationList registrationList)
        {
            var registrator = GetAutoRegistrator();

            lock (_regLock) {
                using (ServiceLocator.Batch()) {
                    foreach (var regInfo in registrationList)
                    {
                        registrator.AutoRegister(regInfo);
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Iterates through all the registered <see cref="IServiceRegistration"/> instances
        /// </summary>
        protected virtual void ProcessManualRegistrations()
        {
            var registrationList = ServiceLocator.ResolveServices <IServiceRegistration>();

            if (registrationList == null || registrationList.Count == 0)
            {
                return;
            }

            lock (_regLock) {
                using (ServiceLocator.Batch()) {
                    foreach (var serviceReg in registrationList)
                    {
                        serviceReg.Register(ServiceLocator);
                    }
                }
            }
        }