i have an issue with mapping from source a class that has properties which are in a nested object of a parent class to be mapped to destination a class which have no nested objects.
This is my destination class
public class SCS_OUT_Manifest
{
public string ShipperAddress1 { get; set; }
public string ShipperAddress2 { get; set; }
public string ShipperAddress3 { get; set; }
}
This is my Source class
public class CreateManifestFromToDto
{
public CreateManifestShipperDetailsDto From { get; set; }
}
public class CreateManifestShipperDetailsDto
{
public string ShipperAddress1 { get; set; }
public string ShipperAddress2 { get; set; }
public string ShipperAddress3 { get; set; }
}
I tried something like below, but does not work.
CreateMap<CreateManifestFromToDto, SCS_OUT_Manifest>()
.ForMember(dest => dest, src => src.MapFrom(s => s.From));