object mapping

Copying data from one type to another across a boundary, such as from a database entity to an API response record.

In more detail

Writing it by hand makes every field that crosses the boundary visible and easy to test. Keep business decisions out of mappers.

Example

public static ProductResponse ToResponse(this Product p) => new(p.Id, p.Name, p.Price);

Related terms

Taught in

References