Webservice architecture for online/offline applications
I'm currently writing a utility application to keep track of CodeSnippets, Favourites Links etc and, as a feature of the application, users will have the ability to take the application offline for extended periods of time and still be able to fully maintain the data while in the disconnected state - i.e.: Add/Edit/Delete/Read - not dissimilar to what the TaskVision application does. Users may also have more than one client interface to the application - consider a WindowsForms app at work and a WebForms app running on PocketPC.
For the purposes of discussion consider this scenario:
The application that I'm building will manage all of a users code snippets. Code snippets appear in Categories, and Categories also be broken into sub-categories.
- VB
- StringHandling
- snippet A
- snippet B
- C#
- Conversion
- snippet C
- Misc
- Sorting
- snippet D
My biggest issues were: how to manage concurrency between multiple, disconnected clients and how to minimize the amount of data that I would be sending across the wire? From what I've seen, it's not such an issue with TaskVision because of the kind of data that is being exchanged. The data also has the potential to get big'gish, for example, given 300 snippets at an average size of 1K (including the snippet and other attributes) you'd be looking at serializing nearly .5Mb across the wire for all snippet and category data.
For those that have developed an interest in this type of problem, I've documented my chosen approach and you can view it here:
...basically, it involves a hierarchically structured DataSet being passed between a central Service and the remote clients. Record locking conflicts are resolved through the use of an incrementing key and the size of the dataset is reduced by only passing data that has changes. Conflicts are reported to the clients in exactly the same manner as with the TaskVision applciation, that is, via ROWVERSION'ing on the rows of the DataTables.
I hope to create a more formal "spec" of the architecture and prototype it over the coming week or two.