可以自动映射器从平铺对象创建对象图吗?

Automapper可以将平面对象映射到复杂对象图吗?

 Mapper.CreateMap<PersonDto,Person>()

将PersonDto.BirthCertificateFatherName映射到Person.BirthCertificate.FatherName


不,它不能,它以另一种方式

Person.BirthCertificate.FatherName to  PersonDto.BirthCertificateFatherName

更新:ValueInjecter可以做到这一点:

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

//flatenning
personDto.InjectFrom<FlatLoopValueInjection>(person);
链接地址: http://www.djcxy.com/p/965.html

上一篇: can automapper create an object graph from flatted object?

下一篇: Is there "good" PRNG generating values without hidden state?