Automapper geschachtelten mapping

Ich habe gelesen, die geschachtelten mapping-wiki-Seite, aber es scheint nicht, wie mehrere Ebenen verschachteln. Ich habe die folgenden Karten erstellt und Klassen definiert.

AutoMapper.Mapper.CreateMap<Address, AddressDTO>();
AutoMapper.Mapper.CreateMap<MatchCompanyRequest, MatchCompanyRequestDTO>();

public class MatchCompanyRequest
{
    Address Address {get;set;}
}

public class MatchCompanyRequestDTO
{
    public CompanyInformationDTO {get;set;}
}

public class CompanyInformationDTO {get;set;}
{
    public string CompanyName {get;set;}
    public AddressDTO Address {get;set;}
}

Aber den folgenden code...

//works
matchCompanyRequestDTO.companyInformationDTO.Address =
    AutoMapper.Mapper.Map<Address, AddressDTO>(matchCompanyRequest.Address);

//fails
matchCompanyRequestDTO =
    AutoMapper.Mapper
        .Map<MatchCompanyRequest, MatchCompanyRequestDTO>(matchCompanyRequest);

Nicht dieses Tiefe verschachteln Arbeit und ich habe es nicht richtig konfiguriert? Oder ist diese Art der Verschachtelung noch nicht unterstützt?

-- Edit

Für alle interessierten, ich bin nicht in der Steuerung des DTOs.

InformationsquelleAutor ryan | 2011-10-24
Schreibe einen Kommentar