Server Side and Client Side Caching with .NET and the Microsoft Sync Framework

I recently presented at the Denver Visual Studio User Group on this topic.  The approach I took was to start with an out of the box working Silverlight application and then tweak to using caching for performance reasons.  The next step is to persist that cache on the client side to make it even faster and not even require a round trip to the server.  After that I took it even further by saving the entire data structure to isolated storage to allow offline use of the application using the out of browser option of Silverlight.  Finally I expanded it even further by turning it into a WPF application that stored the data in a local SQL Server data base that was synced back to the server using the Microsoft Sync Framework.  To me this is a pretty natural progression of an application.  Build the prototype and then tweak it through different phases to expand it’s capability.

While building these demos I had to refactor a bunch of things through the progression of the changes.  This again to me is very natural.  I find that if I start by simply solving the problem the pieces of the system that need to be refactored and extend become crystal clear in the end.  Where as if I try to architect the application for every possible future change I tend to end up with an over architected system.  Again keep it simple and refactor later.

I think we all know caching is an essential part of almost every web based application.  That was the gist of the first part of the presentation.  The last part showed some of the pros and cons of the Microsoft Sync Framework.  There is some great documentation around this framework here.  If you are new to the sync framework I suggest taking the time to read through a couple of these docs to understand how it works.  My slides also contain some of information regarding the sync framework.  My personal take on it is it is pretty easy to get started with.  The issue I have is what happens when you get errors.  Synchronizing two data sources is by nature a difficult process and errors will occur.  Using this framework is kind of like using a black box.  You sometimes want more control than you are going to get.  Bottom line if I was looking to sync multiple data sources I would start with this framework.  It is a no brainer to get started with and provides a ton a cool functionality.  However, if I started having issues I might revert back to my old ways of just building a sync tool for my own need.

I had a great time presenting and putting together this talk.  Below is a link to the slides and the completed solution if you are interested.

Demos and Slides