Print Page | Close Window

Offline consideration and Sandbox editing mode ?

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2989
Printed Date: 28-Mar-2024 at 6:24am


Topic: Offline consideration and Sandbox editing mode ?
Posted By: nazbrok
Subject: Offline consideration and Sandbox editing mode ?
Date Posted: 04-Oct-2011 at 4:18am
Hi,

I read the recent post  http://drc.ideablade.com/xwiki/bin/view/Documentation/offline-best-practices - http://drc.ideablade.com/xwiki/bin/view/Documentation/offline-best-practices  and I wonder how is it possible follow these guide while using a sandbox for all the editing/creation ?

For the sandbox mode I have to create a New EntityManager which will apply the changes in base. If I need to have only one EntityManager while being Offline, how can I have a sandbox  ? Is is forbidden to use  a Sandbox while being offline ? If not, could you explain me how to do it ?

regards,






Replies:
Posted By: mgood
Date Posted: 10-Oct-2011 at 8:49pm
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.  



Print Page | Close Window