If a WCF service is consuming ADO.NET Data Services, what is the best approach to expose the Data objects to the WCF conusmers? DTO with your own Data Contract attributes? Is there a way to expose the Data objects directly to the WCF service's clients?
A:
Using a DTO is almost always the best practice.
I haven't looked at ADO.NET Data Services. If they're anything like Entity Framework, then you do not want to expose them directly. Entity Framework exposes implementation-dependent data, including properties of the base classes which have nothing to do with the data you want your consumers to use.
John Saunders
2009-07-28 19:17:53