Reputation: 9124
I'm using AutoMapper and want to know which way is the best approach to map objects differently in different situations (for example, ignore one field in MethodA, include that field in MethdoB etc.). I can create My own MappingEngine but I was wonderign if there was a better way to achieve that.
Upvotes: 2
Views: 467
Reputation: 4634
You can map one source to multiple destinations with automapper. For example you can have a source object with
Person
and view models
ContactInfoViewModel
BioViewModel
Mapper.Map<Person, ContactViewModel>(); Mapper.Map<Person, BioViewModel>();
Upvotes: 1