开发者

can automapper create an object graph from flatted object?

开发者 https://www.devze.com 2022-12-30 16:34 出处:网络
Is possible with Automapper to m开发者_运维知识库ap a flat object to complex object graph? Mapper.CreateMap<PersonDto,Person>()

Is possible with Automapper to m开发者_运维知识库ap a flat object to complex object graph?

 Mapper.CreateMap<PersonDto,Person>()

Map PersonDto.BirthCertificateFatherName to Person.BirthCertificate.FatherName


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);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号