You don't need to map the member; you just need to map both types.
Given:
namespace Db
{
public class Order
{
public List<ShipOnly> Ship { get; set; }
}
public class ShipOnly
{
public string Name { get; set; }
}
}
namespace Dto
{
public class Order
{
public List<ShipOnly> Ship { get; set; }
}
public class ShipOnly
{
public string Name { get; set; }
}
}
Initialization:
Mapper.Initialize(cfg => {
cfg.CreateMap<Db.Order, Dto.Order>();
cfg.CreateMap<Db.ShipOnly, Dto.ShipOnly>();
});
Use:
Db.Order source = new Db.Order
{
Ship = new List<Db.ShipOnly>
{
new Db.ShipOnly { Name = "Test" }
}
};
Dto.Order result = Mapper.Map<Dto.Order>(source);
Debug.Assert(result.Ship != null);
Debug.Assert(result.Ship.Count == 1);
Debug.Assert(result.Ship[0].Name == "Test");