© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•13mo ago•
3 replies
reeeeeee

Where to handle mapping between DTOs and Entity objects?

Lets say I have controller GET /users/ which returns UserDTO. Where would I do this mapping between User and UserDTO?
- In controller: userService.GetUsers -> transform to UserDTO list -> return list
- in service: Method UserService.GetUsers does the mapping and returns UserDTO list
- in separate service: I have two methods in my service: GetUsers (which returns Entity objects) and GetUsersDTO (which calls GetUsers method and map it)
- anything else?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Where to map DTOs & Entities
C#CC# / help
4y ago
❔ Avoiding duplicating code between DB models and DTOs
C#CC# / help
3y ago
DTOs inside of DTOs
C#CC# / help
4y ago
How to map Entity Framework entities containing circular references to DTOs?
C#CC# / help
3y ago