2

I have a class(say CustomClass) which has few properties of type IEnumerable<Enum>.

Pass the object of CustomClass over the WCF and return object of Result type(different type).

If I check CustomClass parameter in WCF after its gets everything done and about to send response back to the client, CustomClass parameter has that value, but by the time response reaches to the client, object of CustomClass clear all the contents of that List property.

I just want to know, why?

Structure of Custom Class is

 public class QuerySearchCriteria 
 {       
    [DataMember]
    public string DScope { get; set; }

    [DataMember]
    public IEnumerable<SOURCE> Sources { get; set; }

    [DataMember]
    public IEnumerable<ETYPE> ETypes { get; set; }

    [DataMember]
    public IEnumerable<Score> Score{ get; set; }       
}

Everything goes fine, but items in Score property are removed.

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
Manvinder
  • 4,495
  • 16
  • 53
  • 100

1 Answers1

0

Just guessing based on the information you're provided but is Score a serializable class? In WCF, enumerations are automatically included since they're marked Serializable unless you've manually marked the Enum type class with DataContract. In that case, you need to mark each member of the Enum as EnumMember. This SO question and answer has a good explanation of how that works.

If I guessed wrong :) then you should enable WCF tracing and post the soap that is being created by the service to get more detail on what's going on. Also, posting the source for the Score class would be helpful.

Community
  • 1
  • 1
Sixto Saez
  • 12,610
  • 5
  • 43
  • 51