Proxy class not having equals method WCF

696 Views Asked by At

I have a class as DataContract in my webservice and it inherit from IEquatable. But my siverlight webservice generated proxy class does not have equals. Can any one tell me why this is happening and is there a way achieve this?

1

There are 1 best solutions below

2
On BEST ANSWER

WCF serializes only data from data contracts - no methods or behavior.

That's by default and by design - after all, WCF is a message passing system - you pass around serialized messages only.

WCF is NOT a "remote-procedure call" or "object remoting" system and thus, when creating a proxy, it will make sure the data signature on the wire will be identical (by means of XML serialization) - and that's all it does.

The only option to achieve what you're looking for would be to:

  • create a separate class library assembly that contains the service and data contract classes
  • reference that common contract assembly from both your server-side service code, as well as your client-side Silverlight app
  • when creating a service reference now, Visual Studio will reuse the common, shared classes in the assembly, and not re-create proxy data classes (and loosing the methods in the process)