79110942

Date: 2024-10-21 16:33:31
Score: 0.5
Natty:
Report link

In my case the problem was someone implemented Map<list<T1>, list<T2>>. Same case after update for .NET8 and AutoMapper 13 I encountered similar message (not too much descriptive for me).

My solution was removing the list and "assume" AutoMapper is enough smart to map the list. Map<T1, T2>

I said "assume" because I added this in the startup:

public static List<TDestination> MapList<TSource, TDestination>(this IMapper mapper, List<TSource> source)
{
   return source.Select(x => mapper.Map<TDestination>(x)).ToList();
}
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: Juanan