Hi! Have this scenario:
Public class Base { public string Name; }
Public Class ClassA :Base { public int32 Number; }
Public Class ClassB :Base { Public string Description;}
Public Class DTO {
public string Name;
public int32 Number;
Public string Description;
}
I have an IList<Base>
my maps are:
AutoMapper.Mapper.CreateMap<IList<Base>, IList<DTO>>()
.ForMember(dest => dest.Number, opt => opt.Ignore())
.ForMember(dest => dest.Description, opt => opt.Ignore());
AutoMapper.Mapper.CreateMap<ClassA, DTo>()
.ForMember(dest => dest.Description, opt => opt.Ignore());
AutoMapper.Mapper.CreateMap<ClassB, DTO>()
.ForMember(dest => dest.Number, opt => opt.Ignore())
Mapper.AssertConfigurationIsValid(); //Is OK!
But Properties that are in ClassA Or ClassB are not mapped when I do this :
IList<DTO>= AutoMapper.Mapper.Map<IList<Base>,IList<DTO>>(baseList);
How can I do to map properties that are defined in ClasA
and ClassB
Thanks