private void DryRunTypeMap(ICollection<TypeMap> typeMapsChecked, ResolutionContext context)
{
var typeMap = context.TypeMap;
if (typeMap != null)
{
typeMapsChecked.Add(typeMap);
CheckPropertyMaps(typeMapsChecked, context);
}
else
{
var mapperToUse = _config.GetMappers().FirstOrDefault(mapper => mapper.IsMatch(context.Types));
if (mapperToUse == null && context.SourceType.IsNullableType())
{
var nullableTypes = new TypePair(Nullable.GetUnderlyingType(context.SourceType),
context.DestinationType);
mapperToUse = _config.GetMappers().FirstOrDefault(mapper => mapper.IsMatch(nullableTypes));
}
if (mapperToUse == null)
{
throw new AutoMapperConfigurationException(context);
}
if (mapperToUse is ArrayMapper || mapperToUse is EnumerableMapper || mapperToUse is CollectionMapper)
{
CheckElementMaps(typeMapsChecked, context);
}
}
}