Search code examples
c#wcfwebserverdatamemberjava-client

How to send class equals implementation to client using a WCF Web Server


I'm developing an aplication in java (JSF) which communicates whith an WCF web server. I developed the webserver using c#, and I'm havin trouble to send the equals implementation of an complex object to the java client. For example, consider this c# class:

[DataContract(Namespace = "http://mywebservice.com/Entidades")]
    public class Record{private Int64 id;
    [DataMember]
    public Int64 Id
    {
        get { return id; }
        set { id = value; }
    }

    public override bool Equals(Object obj)
    {
          if(obj is Record){
               Record rec = obj as Record;
               return rec.Id == this.Id;
         }
         return false;
    }

}

First tryed to put the [DataMember] in the equals, but I discovered that I can't do that. How is the right way to send this implementation of the "equals" of this complex type to the java client?

Thanks in advance


Solution

  • That doesn't make sense.
    Web services transfer data, not code.

    You need to implement equals() in you Java objects in source.