Automapper: map child property with existing mapper using instance API
问题 I'm trying to map one complex object to another using instance API: var config = new MapperConfiguration(cfg => { cfg.CreateMap<Student, PersonType>(); cfg.CreateMap<Professor, PersonType>(); cfg.CreateMap<Branch, BranchType>() .ForMember(x => x.Departments, opt => opt.MapFrom(src => new DepartmentType[] { new DepartmentType { Students = Mapper.Map<Student[], PersonType[]> (src.Students), Professors = Mapper.Map<Professor[], PersonType[]> (src.Professors), Name = src.DepartmentName } }))