It's possible to still have sandboxes. You'll have to treat the central offline cache as a pass-through cache. The individual sandboxes will delegate query and save operations to the central offline manager. The purpose of the offline manager is to be a mirror of your datasource. Everything that is queried from the datasource should be queried into the offline manager and then imported into the sandbox. Similar for the save, the offline manager should be implemented as a write-through cache. So, if the app is online, the offline manager keeps track of everything any of the sandboxes query, so that if suddenly you lose connection, the offline manager has a copy of everything that has been queried so far. New sandboxes that spin up simply query from the offline manager if they can't reach the server. For the save, if the app is online, the saves go directly through to the server. If the app is offline, the offline manager keeps the changed entities until it can sync them back to the server. It's quite a bit of work to get this all working and you'll have to implement logic to make sure all the caches stay coherent. When I implemented this, I basically created new query and save extension methods that encapsulated all this pass-through logic.
|