Search code examples
codefluent

Serialize Emit Default Values


How can I change the EmitDefaultValue in my entities from model? BOM Producer, even when the dataMember is set to true, is omitting the serialization of null values thus sending incomplete objects to the client application.

[System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=111)]

Solution

  • You can set the value of EmitDefaultValue at project level or property level:

    <cf:project cfsm:emitDefaultValue="true" 
               xmlns:cfsm="http://www.softfluent.com/codefluent/producers.servicemodel/2007/1">
    
    
    <cf:property cfsm:emitDefaultValue="true" 
              xmlns:cfsm="http://www.softfluent.com/codefluent/producers.servicemodel/2007/1">