If I want to do bi-directional mapping, do I need to create two mapping?
Mapper.CreateMap<A, B>() and Mapper.CreateMap<B, A>()
?
If I want to do bi-directional mapping, do I need to create two mapping?
Mapper.CreateMap<A, B>() and Mapper.CreateMap<B, A>()
?
Yes, but if you find yourself doing this often:
then:
This is now baked into AutoMapper
Great idea Eric! I've added a return value, so the reverse mapping is configurable too.
Yes, because if you change the type of some property (for example DateTime -> string) it is not bidirectional (you will need to instruct Automapper how to convert string -> DateTime).