private void BeginServiceInfoInitialization(Service service, ServiceRegistrationInfo info, IEnumerable <IRegistrationSource> registrationSources)
        {
            // Add any additional service pipeline configuration from external sources.
            foreach (var servicePipelineSource in _servicePipelineSources)
            {
                servicePipelineSource.ProvideMiddleware(service, this, info);
            }

            info.BeginInitialization(registrationSources);
        }
Example #2
0
        private ServiceRegistrationInfo GetInitializedServiceInfo(Service service)
        {
            ServiceRegistrationInfo serviceInfo = this.GetServiceInfo(service);

            if (!serviceInfo.IsInitialized)
            {
                if (!serviceInfo.IsInitializing)
                {
                    serviceInfo.BeginInitialization(this._dynamicRegistrationSources);
                }
                while (serviceInfo.HasSourcesToQuery)
                {
                    Func <IRegistrationSource, bool> predicate = null;
                    IRegistrationSource next = serviceInfo.DequeueNextSource();
                    foreach (IComponentRegistration registration in next.RegistrationsFor(service, new Func <Service, IEnumerable <IComponentRegistration> >(this.RegistrationsFor)))
                    {
                        foreach (Service service2 in registration.Services)
                        {
                            ServiceRegistrationInfo info2 = this.GetServiceInfo(service2);
                            if (!info2.IsInitialized)
                            {
                                if (!info2.IsInitializing)
                                {
                                    if (predicate == null)
                                    {
                                        predicate = src => src != next;
                                    }
                                    info2.BeginInitialization(this._dynamicRegistrationSources.Where <IRegistrationSource>(predicate));
                                }
                                else
                                {
                                    info2.SkipSource(next);
                                }
                            }
                        }
                        this.AddRegistration(registration, true);
                    }
                }
                serviceInfo.CompleteInitialization();
            }
            return(serviceInfo);
        }