In my case I was using
.ProjectTo<>()
To project directly from a DBContext collection (EF 6) to my DTO e.g.
db.Configuration.LazyLoadingEnabled = false;
prospects = db.Prospects.Where([my where lambda]).ProjectTo<ProspectDTO>().ToList();
With a destination with an IEnumerable<string>
property coming from a M-M related table i.e.
public class ProspectDTO
{
public IEnumerable<string> Brands { get; set; }
}
and my solution was mapping as follows
AutoMapper.Mapper.CreateMap<Prospect, ProspectDTO>().ForMember(dest => dest.Brands, opts => opts.MapFrom(src => src.Brands.Select(b => b.Name)));
N.B. I am using the ProjectTo<> like this to avoid the common lazy loading select n+1 problem and ensure decent (quick) sql runs against the DB, and I have all the related table data I need. Excellent.
Thanks Jimmy Bogard you rockstar !!!