7

Automapper を使用してフラット オブジェクトを複雑なオブジェクト グラフにマップすることは可能ですか?

 Mapper.CreateMap<PersonDto,Person>()

PersonDto.BirthCertificateFatherName を Person.BirthCertificate.FatherName にマップします。

4

1 に答える 1

3

いいえ、できません。逆の方法で行います。

Person.BirthCertificate.FatherName to  PersonDto.BirthCertificateFatherName

更新:ValueInjecterはこれを行うことができます:

//unflattening
person.InjectFrom<UnflatLoopValueInjection>(personDto);

//flatenning
personDto.InjectFrom<FlatLoopValueInjection>(person);
于 2010-05-26T08:27:00.413 に答える