I have the following class:
public class FooDto
{
public string Secret { get; set; }
}
I have configured the mapping as follows:
config.NewConfig<Foo, FooDto>() Map(dest => dest.Secret, src => MapContext.Current.GetService<IEncryptionService>().Decrypt(src.Secret));
When I try to map to a list:
_mapper.Map<IEnumerable<FooDto>>(fooObjList);
I Get the error "Mapping must be called using ServiceAdapter"
However when I map without a list it works fine:
_mapper.Map<FooDto>(fooObj);
It seems that when mapping to a collection the MapContext is unavailable