specialized classes to ease the manual conversion of data between different types of objects within the application.
where these objects are request DTOs, domain entities, and response DTOs.
DTOs are type of objects that are meant for transferring data between different layers of an application (like between presentation layer and business logic layer).
-
request DTOs : are the type of data objects that come from client to server
-
response DTOs : type of data being sent to the client
-
nutshell : request DTOs would be the objects that hold the data coming in from the client, and response DTOs would be the objects that hold the data being sent back to the client.
-
domain entities are the objects that represent the core business concepts in the application.
now discussing mappers : they are used to transform request DTOs into domain entities and then transform those domain entities into response DTOs.
nutshell : don't expose those domain entities instead, use mappers to control what data to be sent and recieved.
-- mapper classes are used as singletons according to documentation. please refer to this documentation link : https://fast-endpoints.com/docs/domain-entity-mapping#mapping-logic-in-a-separate-class