2

如何将复杂的 UploadDTO 映射到实体编号?

public class UploadDTO
{
    public CustomerDTO Customer { get; set; }
    public MachineDTO Machine { get; set; }
    public NumberDTO Number { get; set; }
}

public class Number
{
    public Customer Customer { get; set; }
    public Machine Machine { get; set; }
}

更新

Mapper.CreateMap<CustomerDTO , Customer >();
 Mapper.CreateMap<MachineDTO , Machine >();
 Mapper.CreateMap<NumberDTO , Number>();

问题是缺少 UploadDTO 映射,因此它不起作用。但我怎么能说:“以 UploadDTO.Customer TO Customer 为例?”

4

1 回答 1

0

只需添加从 UploadDTO 到 Number 的缺失映射:

Mapper.CreateMap<UploadDTO , Number>();
于 2015-05-22T15:24:52.807 回答