1
votes

I am returning data from different domain repositories to my service and from the service to my Asp.net WebApi controller to the client. The data is put into a DTO.

Should I use the same DTO to transfer the data from the client to server although I would have to add some properties which are not used from server to client.

Is that approach ok or should I use different DTO`s ?

1

1 Answers

1
votes

HTTP, and therefore WebAPI, deal in Requests and Responses. Its a matter of opinion, but I would venture that if there is even a small difference I would go ahead and make individual objects/DTOs to echo the HTTP request & response design in your code.

This would also adhere to the Single Responsibility Principle.