Using the abp.io framework on their implementation of AutoMapper which is integrated with the framework I'm having some issues mapping collections.
With abp.io our entities have various audited properties, creation, mofification times and records etc. These properties do not show on our Dtos. The mapping config extension IgnoreFullAuditedObjectProperties() should stop these properties being erased when updating an entity using AutoMapper.
However I'm having some issues with CreationTime and and CreatorId being cleared on update when mapping a collection specifically.
I have the following mapping:
CreateMap<ExpenseDto, Expense>()
.IgnoreFullAuditedObjectProperties()
.ReverseMap();
If I update objects using the mapper individually IgnoreFullAuditedObjectProperties is followed, and I keep the CreationTime and CreatorId.
Like this:
ObjectMapper.Map<ExpenseDto, Expense>(expenseDto, expense);
That works as expected.
However if I try and update a collection using the mapper, I loose all the CreationTime and CreatorId properties.
ObjectMapper.Map<List<ExpenseDto>, List<Expense>>(expenseDtos, expenses);
Everything else maps ok with the updated collection mapping, it just seems to not use the IgnoreFullAuditedObjectProperties() config on the mapping.
Am I doing anything wrong?