Search code examples
c#wpfwcfmappingdto

What to do with DTOs on the Client side of a WCF Service


I have a WCF Service which maps EF Entities to DTOs to send the data to a WPF Client application, when the WPF Client updates the service reference it generates all of the DTOs (as partial classes) defined at the Service.

My question is: on the WPFClient side should I directly take these DTOs as Models and extend them using partial classes to add extra fields, methods to fetch the data, etc. Or should I create a new class and map again from the generated DTOs to the new class?


Solution

  • I would consider creating new objects, treat your DTOs simply as "transport" objects. You don't want to risk ending up with functionality, if any, business logic in your DTOs.