Sending Linq to SQL classes via webservice

I have a Windows app and a web service. Both have a Linq to SQL binding with a Customer table on them. The same table from the same database, the same. I tried to send a winapp.Customer object for a web service, but webserviceReference.MyMethod () takes a webservice.Customer object and doesn't take winapp.Customer as a parameter. Tried to cast winapp.Customer to webservice.Customer but didn't work. Is there a way to do this?

+2


source to share


2 answers


No, this cannot be done using ASMX web services. They require the proxy type and real type to be different.

You can accomplish this with WCF, although it violates the SOA idea (client and server will be linked by common class code).



Finally, there are issues with passing LINQ to SQL or Entity Framework classes using any web services. Microsoft messed up and serializes implementation-specific data as it transitions between tiers. This may make sense when the levels are on the same computer, but much less meaningful when they are on different machines.

+3


source


In your WinApp, you probably have to write an explicit conversion from winapp.Customer to webservice.Customer.



0


source







All Articles