views:

22

answers:

1

Dear ladies and sirs.

Inspecting the soap-xml produced by WCF I notice that many fields appear with their default values. Is it possible to instruct WCF somehow to omit such fields in serialization?

Thanks.

+1  A: 

Yes. If you're using DataContractSerializer, apply

[DataMember(EmitDefaultValue=false)]

to these fields.

Dmitry Ornatsky
Thanks, unfortunately I do not work with data contracts directly. The business object framework I am using (CSLA) is dealing with it. I am wondering if there is some kind of a master setting, which can be turned on and be applied to all the primitive fields.
mark