views:

206

answers:

2

I have an application which consumes both a WCF service and an ADO.NET Data Service. Types are shared between the server and client using a shared class library.

When I configure the service reference for the WCF service, I can choose to use the existing types in the class library to avoid creating duplicate types in the proxy classes.

But Visual Studio doesn't offer me the option to do that on the ADO.NET Data Service.

Is it possible for an ADO.NET Data Service to reuse existing types?

+4  A: 

Great question.

Yes this is definitely possible.

I just put together a Tip that show you how to turn off default Code-Gen and reference an existing type instead, and showing how too tell the DataServiceCpntext how to do the mapping between the type expected on the wire and the type used on the client.

NOTE: that even though the Types might be the same inside the DataService and on the client it is still possible that the Data Service has been configured to expose the Server types in a different namespace, so this mapping may still be required.

Anyway I'm sure Tip 52 will help you get your scenario working.

Alex

Alex James
A: 

Way i would do is instead of creating proxy through add service option. Use DataServiceContext directly then can use

Execute<TypeOfData> method
mamu