I'm trying to find a way to have a mapping configuration that can map between totally different names from a list.
Our database is in Dutch and scaffolding tooling (like scaffold-dbcontext) keeps the table names for the DTO's. Outside our db related layers we would prefer English nouns.
Say I have the following
Afdeling
Id: int
TypeKode: string
Werkenemers: Persoon[]
Department
Id: int
TypeCode: string
Employees: Person[]
Given I know the following word mapping
Afdeling Department
Kode Code
Werkenemers Employees
Persoon Person
Is it then possible to configure AutoMapper to be able to map as such:
Department department = Mapper.Map<Afdeling, Department>(afdeling);
Yes you can do that. Here is code sample, but note it's just sample. It shows general approach but is not complete and contains some unnecessary things, so make sure you understand what's going on there.
First, custom mapper:
Then