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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With