public class A { public List<B> bs{get; set;} } public class B { public string name {get; set;} } public class ACopy { public List<BCopy> bCopy{get; set;} } public class BCopy { public string name {get; set;} }
映射:源:ACopy To: A
config.CreateMap<ACopy, A>() .AfterMap((src, dest, o)=> { foreach (var item in src.bCopy) { dest.bs.Add(o.Mapper.Map<B>(item)); } }); config.CreateMap<BCopy, B>();