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?
Asked
Active
Viewed 681 times
1 Answers
5
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)

marc_s
- 732,580
- 175
- 1,330
- 1,459
-
@Madhan: use the shared common assembly approach I mentioned in my answer (in an update to my original response) – marc_s Feb 16 '11 at 12:08
-
But you will need to put those files in project that is targeting Silverlight as Silverlight cannot reference .Net assemblies. So you will have two projects referencing same files but with different target. – bartosz.lipinski Feb 16 '11 at 12:47