Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reuse existing types with ADO.NET Data Services

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?

like image 354
Ian Gregory Avatar asked Jan 24 '10 21:01

Ian Gregory


1 Answers

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

like image 98
Alex James Avatar answered Sep 30 '22 15:09

Alex James