Mid ASP.NET Core

DTOs and mapping (e.g. AutoMapper)?

  • DTOs decouple internal models from API contracts.
  • Use AutoMapper for mapping:

CreateMap<Product, ProductDto>();

var dto = _mapper.Map<ProductDto>(product);

More from ASP.NET Core Tutorial

All questions for this course