in src/React.Core/TinyIoC/TinyIoC.cs [1731:1765]
public MultiRegisterOptions RegisterMultiple(Type registrationType, IEnumerable<Type> implementationTypes)
{
if (implementationTypes == null)
throw new ArgumentNullException("types", "types is null.");
foreach (var type in implementationTypes)
//#if NETFX_CORE
// if (!registrationType.GetTypeInfo().IsAssignableFrom(type.GetTypeInfo()))
//#else
if (!registrationType.IsAssignableFrom(type))
//#endif
throw new ArgumentException(String.Format("types: The type {0} is not assignable from {1}", registrationType.FullName, type.FullName));
if (implementationTypes.Count() != implementationTypes.Distinct().Count())
{
var queryForDuplicatedTypes = from i in implementationTypes
group i by i
into j
where j.Count() > 1
select j.Key.FullName;
var fullNamesOfDuplicatedTypes = string.Join(",\n", queryForDuplicatedTypes.ToArray());
var multipleRegMessage = string.Format("types: The same implementation type cannot be specified multiple times for {0}\n\n{1}", registrationType.FullName, fullNamesOfDuplicatedTypes);
throw new ArgumentException(multipleRegMessage);
}
var registerOptions = new List<RegisterOptions>();
foreach (var type in implementationTypes)
{
registerOptions.Add(Register(registrationType, type, type.FullName));
}
return new MultiRegisterOptions(registerOptions);
}