I would like to know what is the best practice in designing the constructors of DTO objects.
say i have a Dto object like this:
class CustomerDto
{
I would suggest using immutable data structures so DTO entity would not expose any setters, obviously in this way constructor should provide ability to initialize all underlying properties of a given DTO.
So I prefer:
public CustomerDto(string name, string surname, string phone, ...)
DTO is a Data Transfer Object, especially to represent a set of properties to be passed across a system (distributed as well) boundaries, so do not bother too much regarding SRP violation. This is like Facade design pattern, it abstarcts a set of operations/services to simplify usage. So in this kase Keep It Simple won.