Windows Phone 7 Tutorial Part 3 Available
I just published the third tutorial in my series on Windows Phone 7. This part completes the Golf Handicap application by adding the ability to manage scores from rounds of golf.
This was a very interesting exercise and provides a example of using OData and web services with Windows Phone 7.
My initial design of the Scores view model was based on the ability in OData to use the “expand” operation so that an entity AND its associated entity could be downloaded from the web service. I built a DataServiceCollection of Scores and each score included the single course it was associated with. As you can see in the image above, a score only makes sense in the context of the course were the round was played.
This initial design worked great until I started to test out “Tombstoning” – the ability of the application to be placed into the background while another application is running and then restored when the application is brought back to the foreground. I simply could not make the code work; trying to restore the data service state threw an exception no matter what I tried.
I spent several days trying a variety of things to correct the problem. Finally, in frustration, I posted a query on the Data Services forum to see if I could get some help. Shortly after posting the question, a Microsoft person informed me that data service state’s “Restore” method could not handle an object graph with more than one entity. In other words, I could not do what I was trying to do given the current capabilities of the OData Data Services. Hopefully that shortcoming will be overcome in later releases.
In the mean time, you can see how I revised my design (and the implications of the revised design) in this new tutorial.
Enjoy … bill