Only send populated object properties over WCF?
Posted
by dlanod
on Stack Overflow
See other posts from Stack Overflow
or by dlanod
Published on 2010-05-13T00:04:58Z
Indexed on
2010/05/13
0:14 UTC
Read the original article
Hit count: 536
I have an object that is being sent across WCF that is essentially a property holder - it can potentially have a large number of properties, i.e. up to 100, but in general only a small subset will be set, up to 10 for instance.
Example:
[DataContract(Namespace = "...")]
public class Monkey
{
[DataMember]
public string Arms { get; set; }
[DataMember]
public string Legs { get; set; }
[DataMember]
public string Heads { get; set; }
[DataMember]
public string Feet { get; set; }
[DataMember]
public string Bodies { get; set; }
/* repeat another X times */
}
Is there a way to tell WCF to only send the populated properties over the wire? It seems like a potential waste of bandwidth to send over the full object.
© Stack Overflow or respective owner