AfterMap context.mapper.map does not call the expected map

115 views Asked by At

A breakpoint in the following code in line resContext.Mapper... does stop the execution

CreateMap<MedicationFactory.Definition, TimeDescription>()
    .IgnoreAllUnmapped()
    .AfterMap((adapter, description, resContext) =>
    {
        resContext.Mapper.Map<MedicationTimePattern, TimeDescription>(adapter.TimePattern, description);
    })

I assume next this map should be called, but that seems not to be the case. A breakpoint here in the line resContext.Mapper is never hit. Is there an obvious reason?

CreateMap<MedicationTimePattern, TimeDescription>()
    .IgnoreAllUnmapped()
    .ForMember(dst => dst.ExtendedRRules, 
        src => 
        src.MapFrom((source, destination, member, resContext) =>
        {
            return resContext.Mapper.Map<ExtendedRRule[]>(source.ClassicDosage.ToRRule().ToArray());
        }))

Already tried https://docs.automapper.org/en/stable/Understanding-your-mapping.html but that did not really help.

0

There are 0 answers