Don't call us... and we also wont call you.

Been doing a little WCF today... I augmented a partial message
class on a client with some additional properties, including

private bool _partOfResults = true;

public bool PartOfResults
get { return _partOfResults; }
set { _partOfResults = value; }

Now I assumed by default the any messages would have
PartOfResults set to true... just like it used to
work with ye olde XmlSerializer ;o)

But actually no ... WCF doesn't invoke the constructor - surprised
I hadn't noticed until now - particularly annoying is of course my
unit tests were passing because I was calling the default
constructor on the message... so first of all I decided to cheat
and just implement the method like this:

private bool _partOfResults;

public bool PartOfResults
get { return !_partOfResults; }
set { _partOfResults = !value; }

But I didn't like the implications ;o) so I went and actually
looked up how to make it work properly:

private void InitializeExtraFields(StreamingContext context)
_partOfResults = true;

Pretty boring ;o) just surprised me because I haven't done much WCF
since it went final.
Written on April 30, 2007