Automapper – mapowanie z właściwości obiektu na osobne stringi

0

Co muszę podać w konfiguracji Automappera, zeby zmapować Vehicle na VehicleDto. Nie wiem jak zmapować właściwość Route na Source i Destination,
czyli chcę zrobić, żeby

_vehicle.Route.Source => _vehicleDto.Source
_vehicle.Route.Destination => _vehicleDto.Destination
public class Route
{
 public string Source {get;set;}
 public string Destination {get;set;}
 ...
}

public class Vehicle
{
 public int Id{get;set;}
 public string Name{get; set;}
 public Route Route {get;set;}
 ...
}

public class VehicleDto
{
 public string Name {get; set;}
 public string Source{get; set;}
 public string Destination {get; set;}
}
0
             Mapper.CreateMap<GroupReservationPaymentContract, PaymentPostApiRequest>()
                .ForMember(dest => dest.PayAmount, opt => opt.MapFrom(src => src.PaymentAmount))
                .ForMember(dest => dest.PaymentMethod, opt => opt.MapFrom(src => ForeignKey.Create(src.PaymentMethodCode)))
                .ForMember(dest => dest.ShiftCode, opt => opt.Ignore())
                .ForMember(dest => dest.DateInvoice, opt => opt.Ignore())
                .ForMember(dest => dest.Info, opt => opt.Ignore());

tu masz jakis przykladowy kod. Powinien Ci rozjasnic co trzeba zrobic

dla kazdego obiektu ktory musi byc zmapowany musisz stworzyc mape

1 użytkowników online, w tym zalogowanych: 0, gości: 1