Esempio n. 1
0
 internal static void IsNotAnAmbiguousType(Type type, string paramName)
 {
     if (Types.IsAmbiguousType(type))
     {
         throw new ArgumentException(StringResources.TypeIsAmbiguous(type), paramName);
     }
 }
Esempio n. 2
0
        private InstanceProducer TryBuildArrayInstanceProducer(Type serviceType)
        {
            if (serviceType.IsArray)
            {
                Type elementType = serviceType.GetElementType();

                // We don't auto-register collections for ambiguous types.
                if (elementType.IsValueType() || Types.IsAmbiguousType(elementType))
                {
                    return(null);
                }

                bool isContainerControlledCollection =
                    this.GetAllInstances(elementType) is IContainerControlledCollection;

                if (isContainerControlledCollection)
                {
                    return(this.BuildArrayProducerFromControlledCollection(serviceType, elementType));
                }
                else
                {
                    return(this.BuildArrayProducerFromUncontrolledCollection(serviceType, elementType));
                }
            }

            return(null);
        }