I am trying to use (POST/PUT) a DTO object with a collection of child objects from JavaScript to an ASP.NET Core (Web API) with an EF Core context as my data source.
<
AutoMapper is the best solution.
You can do it very easily like this :
Mapper.CreateMap();
Mapper.CreateMap();
Mapper.CreateMap();
Mapper.CreateMap();
Note : Because AutoMapper will automatically map the List to List.since they have same name, and there is already a mapping from Person to PersonDto.
If you need to know how to inject it to ASP.net core,you have to see this article : Integrating AutoMapper with ASP.NET Core DI
Auto mapping between DTOs and entities
Mapping using attributes and extension methods