I have a windows application and a web service. Both have a Linq to SQL mapper with Customer table on them. Same table from the same database, same everything. I tried to send winapp.Customer object to web service but the webserviceReference.MyMethod() accepts webservice.Customer object and doesn't accept winapp.Customer as parameter. Tried to cast winapp.Customer to webservice.Customer but didn't work either. Is there a way to accomplish this?
A:
In your WinApp, you'll probably have to write an explicit conversion from winapp.Customer to webservice.Customer.
Justin Niessner
2009-10-05 15:07:57
+3
A:
No, there is no way to accomplish this using ASMX web services. They require that the proxy type and the real type be different types.
You can accomplish this using WCF, though it breaks the idea of SOA (the client and server will be tied together by the common class code).
Finally, there are problems with passing LINQ to SQL or Entity Framework classes using web services of any kind. Microsoft messed up and serializes implementation-dependent data when passing between tiers. This may make sense when the tiers are on the same computer, but makes much less sense when they are on different machines.
John Saunders
2009-10-05 15:20:01