Search code examples
c#.netasp.net-corearchitecturerequest-response

Difference between DTO and Response Object?


What is the difference between a Response Object and DTO in software architecture? Say I want to get a list of Products in a catalog.

If ProductDTO is this, how is a Product Response class different? Is a Product Response typically just a wrapper with a datetime, error log, or guid, or what is the prime difference? If there is not an exact or multiple answers, would like to hear top reasons in industry.

public class ProductDto
{
    public int ProductId { get; set;},
    public string ProductName { get; set;},
    public string ProductDescription { get; set;},
    public float SalesAmount { get; set;}
}

I tried googling these answers, they did not have specific answer for this question,

Reusing DTO for various request/response types vs explicitness of what is required / what should be returned

Data Objects for each layer(DTO vs Entity vs Response objects)

Update:

Trying to validate answer. Seems Rahul answer is answering difference between Domain object and DTO . Thought Response is a wrapper around DTO, not sure if true-

http://themoderndeveloper.com/the-modern-developer/requesting-a-response/

Posted here now:

https://softwareengineering.stackexchange.com/questions/398783/what-is-difference-between-dto-and-response-object


Solution

  • From what I've seen, a Response object can contain a Status Field on top of the DTO which indicates if the request has succeeded; or if not, why it has failed.

    But I am not quite sure this is a documented norm.