Best practice design DTOs for CRUD ASP.NET Core?

Viewed 682

I have DTOs Layer to transfer data between API Layer, Data Layer and other I have a question for DTO design pattern in c#

Example:

public class ProductDTO{
    public int Id {get;set;}
    public string Name {get;set;}
    public decimal Price {get;set;}
    public int CategoryId {get;set;}
    public string Desc {get;set;}
}

Should i split this ProductDTO for CRUD?

Example:

public class ProductInsertDTO
{
    public string Name {get;set;}
    public int CategoryId {get;set;}
}

for ProductDTO (500 byte) and ProductInsertDTO (293 byte) when I transfer data

1 Answers

No. For such small amounts of data, the network overhead is much more of an issue. The rule of the thumb is: avoid "chatty" communications. Better exchange more in one call than split it to multiple calls.

Related