The proxy class has no equals WCF method

I have a DataContract class in my web service and it inherits from IEquatable. But my siverlight webservice generated proxy class has no equal. Can someone tell me why this is happening, and is there a way to achieve this?

+4
source share
1 answer

WCF only serializes data from data contracts β€” no methods or behavior.

It's by default and by design - after all, WCF is a messaging system - you only transmit serialized messages.

WCF is NOT a "remote procedure" or "object deletion system", and thus, when creating a proxy server, he will make sure that the data signature on the wire is identical (through XML serialization) - and that’s all .

The only way to achieve what you are looking for is:

  • Create a separate assembly of the class library containing classes of service and data contracts.
  • refers to the general assembly of contracts from both your server-side service code and your Silverlight client-side application.
  • when creating a service link, Visual Studio will now reuse common, shared classes in the assembly and not recreate proxy data classes (and lose methods in the process)
+5
source

Source: https://habr.com/ru/post/1339984/


All Articles