.net - What is the point of 'FieldSpecified' in WCF? -


ive noticed if field specified being not mandatory, when generate proxy class generate associated '[fieldname]isspecified' boolean related field. on using fiddler inspect request, if associated 'isspecified' set false, means field not sent on wires.

i have 2 questions related

1.what point of this? purely minimize amount of data being sent across wire?

2.if no value passed parameter on webservice, wcf use default data type it. in case of integer field, default 0. once inside method how possible tell if 0 generated nothing being sent client field, or if indeed sent on 0?

on question 2, specified fields not used only sending side. on receiving side, xml deserialiser set specified fields according presence or absence of corresponding fields on wire, allows service methods find out whether transmitted.

as why want apart compactness of wire representation, example i've seen service allows update several fields in record @ once. in addition setting expected non-null values fields, service uses different wire representations 2 special cases:

  • update field null: <field1 xsi:nil="true" />
  • don't update field: xml element omitted altogether.

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -