Exemplo n.º 1
0
        private static ResolveAllInfo FindAllRegistrations(Type requestedCollectionType, Type itemType, DependencyInjectionContainer container)
        {
            var registrations = container.GetRegistrationsForType(itemType);

            if (registrations != null)
            {
                return(new ResolveAllInfo(new TypeKey(requestedCollectionType), registrations, itemType));
            }

            throw new ResolveException($"There are no registrations present for type \"{requestedCollectionType}\".");
        }
Exemplo n.º 2
0
        protected override ResolveInfo FindForCollectionType(TypeKey requestedTypeKey, DependencyInjectionContainer container, Type closedConstructedIEnumerableType, Registration existingGenericCollectionRegistration)
        {
            var itemType      = GetItemTypeOfCollection(closedConstructedIEnumerableType, requestedTypeKey);
            var registrations = container.GetRegistrationsForType(itemType);

            if (registrations != null)
            {
                return(new ResolveAllInfo(requestedTypeKey, registrations, itemType));
            }

            if (existingGenericCollectionRegistration == null)
            {
                throw new ResolveException($"There is no registration present for type {requestedTypeKey}.");
            }

            return(new ResolveRegistrationInfo(requestedTypeKey, existingGenericCollectionRegistration));
        }