My current project has me with many hats, among which is a developer for the mobile handheld system that our client will use to talk to the central architecture via a WCF layer. This isnt full blown SOA, mainly because you can think of the handheld as complimentary to the web piece that was created first. There isnt enough overlap to justify having a full blown SOA layer. The idea was presented but we choose to take this approach.
Now, one of the things I have come to know about the Compact Framework is that it is totally useless and terrible, except when compared to every other phone/mobile device OS I have ever worked with. There is a long list of things that are not supported from the original framework, such as the TryParse methods. And of course, the way you interact with WCF is also heavily restricted. So much so, you must use a special tool to generate the proxy classes, but that isnt the gotcha, to explain the gotcha, consider the following class:
What you would end up with on the client via the generated proxy class is essentially a class that looks like this:
So, as you can see for non-string properties a “Specified” field is added. This tells the Compact Framework generated base class whether to serialize the data from this property or not. I think this is NOT a good idea. As evidenced by fighting with the system for hours trying to understand why things weren’t serializing right. This just clicked for me today. To me, it speaks to pure laziness by Microsoft. We have patterns, such as Observer and PropertyChanged, for handling this very scenario.
So the trick here is when you are passing your data pack to the server in an object, you need to set the “specified” property to true. To actually see the value on the server. Hope this helps people, cause it drove me nuts.