tags:

views:

36

answers:

1

I generated WCF proxy that has integer [fieldName] in message contract request class. I tried to send value to server but value always came 0 until I manually set [fieldNameSpecified] to true.

Is there something wrong with proxy generation or WCF was designed this way? What are the reasons behind [Specified] fields especially if string/guids have no specified fields in proxy classes?

Thank you in advance

+1  A: 

It's because the Xml Serializer was never updated to support Nullable, so the way it dealt with optional fields using value types (say, an int, which can't be set to null) was to have a XxxSpecified boolean field alongside it that allowed you to tell the serializer whether to consider the value for the corresponding field or not during serialization.

tomasr