We have a level of business logic / data access that we show at several different endpoints through the WCF service. We created a DTO for use as a data service contract. We will use this service through different endpoints for several different applications. In some applications, we need only a few fields from the DTO, while in others we may need almost all of them. For those who need only a few, we really do not want each object to be sent by telegram every time - we would like to get rid of what we really need for this application.
I went back and forth between creating specific DTO sets for use with each application (overkill?) And using something like EmitDefaultValue=false for members that are needed only in certain applications. I also looked at using XmlSerializer rather than DataContractSerializer to have more control over serialization inside the service.
My question is: first, is it worth worrying about the size of the data that we transfer? Secondly, if we assume that the answer is yes or that we decide to take care of it even if it is no, what approach is recommended here and why?
EDIT
Thanks for the answers so far. I was worried that we might fall into premature optimization. I would like to leave the question open for now, however, in the hope that I can get answers to everything else, both for my own instruction and in case someone else has this question, and has good reason for optimization.
source share