Question

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

Était-ce utile?

La solution

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

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

Autres conseils

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top