Is there a clever way to structure my WCF service, such that I can implement a service once and have it return different data contracts for different callers? (i.e. mobile clients)
We have already developed a set of services which are consumed by a desktop application and are now building a mobile version of the application. The problem is that the data transfer objects (DTOs) returned are too big and contain unnecessary members for the mobile application. With it going over a mobile network we would like to cut these out to improve performance, however the implementation of the services will be identical.
Ideas we have so far:
Does anyone know if there is any guidance out there for this requirement?
Personally I would keep the implementations separate. As you point out, each set of clients - mobile and desktop - have different requirements. You can share the contracts for your service, just have different implementations / services. This will allow to specialise the services for each client, and makes it easier to extend, modify and test.