Reusing Existing Types Using ADO.NET Data Services

I have an application that uses both the WCF service and the ADO.NET data service. Types are shared between the server and the client using a common class library.

When I set up a service link for a WCF service, I can choose to use existing types in the class library to avoid creating duplicate types in proxy classes.

But Visual Studio does not offer me to do this in the ADO.NET data service.

Is it possible for the ADO.NET data service to reuse existing types?

+6
c # visual-studio wcf wcf-data-services
source share
2 answers

Great question.

Yes, it is definitely possible.

I just put together a Tip that shows how to disable the default code generator and instead refer to an existing type and show how to say DataServiceCpntext, how to make a mapping between the expected type on the wire and the type used on the client.

NOTE. Although the types may be the same inside the DataService and on the client, it is still possible that the data service is configured to display server types in a different namespace, so this mapping may be necessary.

In any case, I'm sure Tip 52 will help you with your scenario.

Alex

+8
source share

I would do this instead of creating a proxy through the add service function. Use the DataServiceContext directly then you can use

Execute<TypeOfData> method 
0
source share