can automapper create an object graph from flatted object?
Asked Answered
A

1

7

Is possible with Automapper to map a flat object to complex object graph?

 Mapper.CreateMap<PersonDto,Person>()

Map PersonDto.BirthCertificateFatherName to Person.BirthCertificate.FatherName

Anagoge answered 19/5, 2010 at 12:33 Comment(1)
you can do this with the valueinjecter valueinjecter.codeplex.comGondar
G
3

No it can't, it does it the other way

Person.BirthCertificate.FatherName to  PersonDto.BirthCertificateFatherName

UPDATE: ValueInjecter can do this:

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

//flatenning
personDto.InjectFrom<FlatLoopValueInjection>(person);
Gondar answered 26/5, 2010 at 8:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.