2

I've followed this answer (http://stackoverflow.com/a/31182390/58508) to ignore missing properties in destination and it works fine, but I don't know how to do the same for children collection properties.

For example, I've a CustomerViewModel and Customer classes. CustomerViewModel has less properties than Customer class, the mapping from CustomerViewModel to Customer works fine. CustomerViewModel has a property public virtual ICollection<ContactViewModel> Contacts { get; set; } with less properties than Customer property public virtual ICollection<Contact> Contacts { get; set; } property. When I apply a mapping additional destination properties are overwritten in Contact.

My mapping profile is:

CreateMap<CustomerViewModel, Customer>(MemberList.Source);
CreateMap<ContactViewModel, Contact>(MemberList.Source);

Regards

Jose L. Garcia
  • 316
  • 5
  • 14

0 Answers0