AutoMapper: Mapping child collections

automapper, c#

Solution

try

Mapper.CreateMap<Customer, CustomerModel>();
Mapper.CreateMap<Orders, OrderModel>();
Mapper.CreateMap<Invoices, InvoicesModel>();
Mapper.CreateMap<CustomerInfo, CustomerInfoModel>();
var mappedModel = Mapper.Map<Customer, CustomerModel>(customer);

here is another similar topic: AutoMapper - mapping child collections in viewmodel

Problem

AutoMapper Newbie Question. I have a source and destination DTO that have the same fields and child collections. How can AutoMapper map these? Simplified source and destination DTOs share the same names: ``` Customer Orders Invoices CustomerInfo ```

Original source