views:

33

answers:

1
Mapper.CreateMap<A, B>()
      .ForMember(dest => dest.defs, opt => opt.MapFrom(origin => origin.abc));

where defs is array of Def (Def[])

how to map?

+1  A: 
Mapper.CreateMap<A, B>()
      .ForMember(dest => dest.defs, opt => opt.MapFrom(origin => new[]{ origin.abc }));

destination property is array of Def and so the source requries array of something, that's how automapper understands...

this works!!!

Miral
You can also use a custom resolver, if you want to put this logic in a separate, reusable class.
Jimmy Bogard