Example #1
0
        private Registration BuildContainerControlledRegistration(Type closedServiceType,
                                                                  ContainerControlledItem[] closedGenericImplementations)
        {
            IContainerControlledCollection collection = DecoratorHelpers.CreateContainerControlledCollection(
                closedServiceType, this.Container);

            collection.AppendAll(closedGenericImplementations);

            return(DecoratorHelpers.CreateRegistrationForContainerControlledCollection(closedServiceType,
                                                                                       collection, this.Container));
        }
        protected override InstanceProducer BuildCollectionProducer(Type closedServiceType)
        {
            ContainerControlledItem[] closedGenericImplementations =
                this.GetClosedContainerControlledItemsFor(closedServiceType);

            IContainerControlledCollection collection = DecoratorHelpers.CreateContainerControlledCollection(
                closedServiceType, this.Container);

            collection.AppendAll(closedGenericImplementations);

            return(new InstanceProducer(
                       typeof(IEnumerable <>).MakeGenericType(closedServiceType),
                       DecoratorHelpers.CreateRegistrationForContainerControlledCollection(closedServiceType,
                                                                                           collection, this.Container)));
        }
Example #3
0
            private Registration BuildContainerControlledRegistration(Type closedServiceType,
                                                                      Type[] closedGenericImplementations)
            {
                var registrations = (
                    from closedGenericImplementation in closedGenericImplementations
                    select this.CreateRegistrationForClosedGenericImplementation(
                        closedServiceType,
                        closedGenericImplementation))
                                    .ToArray();

                IContainerControlledCollection collection =
                    DecoratorHelpers.CreateContainerControlledCollection(closedServiceType, this.Container);

                collection.AppendAll(registrations);

                return(DecoratorHelpers.CreateRegistrationForContainerControlledCollection(closedServiceType,
                                                                                           collection, this.Container));
            }