How to configure AutoMapper for Polymorphism with explicit member mapping?
问题 Consider the following basic case: Mapper.CreateMap<FromBase, ToBase>() .Include<FromD1, ToD1>() .Include<FromD2, ToD2>(); Mapper.CreateMap<FromD1, ToD1>() .ForMember( m => m.P0, a => a.MapFrom( x => x.Prop0 ) ) .ForMember( m => m.P1, a => a.MapFrom( x => x.Prop1 ) ); Mapper.CreateMap<FromD2, ToD2>() .ForMember( m => m.P0, a => a.MapFrom( x => x.Prop0 ) ) .ForMember( m => m.P2, a => a.MapFrom( x => x.Prop2 ) ); Mapper.AssertConfigurationIsValid(); FromBase[] froms = { new FromD1() { Prop0 =