in Source/Tx.Core/CompositeDeserializer.cs [17:65]
public CompositeDeserializer(
IObserver<Timestamped<object>> observer,
params ITypeMap<TInput>[] typeMaps)
{
_observer = observer;
_deserializers = new List<IDeserializer<TInput>>();
foreach (ITypeMap<TInput> mapInstance in typeMaps)
{
Type mapInterface = mapInstance.GetType().GetTypeInfo().ImplementedInterfaces
.FirstOrDefault(i => i.Name == typeof(IPartitionableTypeMap<,>).Name);
if (mapInterface != null)
{
Type deserializerType =
typeof (PartitionKeyDeserializer<,>).MakeGenericType(mapInterface.GenericTypeArguments);
object deserializerInstance = Activator.CreateInstance(deserializerType, mapInstance);
_deserializers.Add((IDeserializer<TInput>) deserializerInstance);
continue;
}
mapInterface = mapInstance.GetType().GetTypeInfo().ImplementedInterfaces
.FirstOrDefault(i => i.Name == typeof(IRootTypeMap<,>).Name);
if (mapInterface != null)
{
Type deserializerType =
typeof (RootDeserializer<,>).MakeGenericType(mapInterface.GenericTypeArguments);
object deserializerInstance = Activator.CreateInstance(deserializerType, mapInstance);
_deserializers.Add((IDeserializer<TInput>) deserializerInstance);
continue;
}
mapInterface = mapInstance.GetType().GetTypeInfo().ImplementedInterfaces
.FirstOrDefault(i => i.Name == typeof(ITypeMap<>).Name);
if (mapInterface != null)
{
Type deserializerType =
typeof (TransformDeserializer<>).MakeGenericType(mapInterface.GenericTypeArguments);
object deserializerInstance = Activator.CreateInstance(deserializerType, mapInstance);
_deserializers.Add((IDeserializer<TInput>) deserializerInstance);
continue;
}
throw new Exception("The type " + mapInstance.GetType().FullName + " must implement one of these interfaces :"
+ typeof (ITypeMap<>).Name + ", "
+ typeof (IRootTypeMap<,>).Name + ", "
+ typeof (IPartitionableTypeMap<,>).Name);
}
}