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

有帮助吗?

解决方案

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

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

其他提示

Equals is a method, not a property. As such, I don't know of any way you can simply expose this functionality in the model your service exposes.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top