StrataFrame Forum

Synchronization from remote client

http://forum.strataframe.net/Topic7047.aspx

By Larry Tucker - 2/21/2007

ES apparently allows a remote client to access data via HTTP, then run disconnected from the central database.  So, I assume a salesperson could pull down a customer list on his or her laptop and work on it without further internet connection. 

My question is what kind of support does ES offer for synchronizing any changes made to the data once an internet connection is re-established? 

For example, if the salesperson changes a customer's phone number while working disconnected, how does this new phone number get applied to the main database when the salesperson reconnects to the internet? 

Are the synchronization tools built in to ES, or would I have to write it all by hand?  At reconnection, is there an opportunity to open both the local and the central (ES) tables simultaneously and do the needed comparison and updates?

TIA,

Larry

By Lenard Dean - 2/28/2007

Hi Trent,

Just wandering about Larry's question.  Does version 1.6 provide some mechanism to save to a local datastore while the smart client is disconnected from ES?

--Lenard

By Trent L. Taylor - 3/5/2007

My question is what kind of support does ES offer for synchronizing any changes made to the data once an internet connection is re-established?

You could do this with StrataFrame even prior to the ES.  This is more of a disconnected data feature rather than an ES feature.  For example, once you have data within the BO it can be modified and maintained and there is no "keep-alive" data session.  The connection is re-established when a request to the DAL (Data access layer) is performed, such as a Save(), SELECT, etc. 

The ES provides a way to communicate real-time from anywhere...fast!  So in the case of pulling data down and then updating it later there are a number of options.  The most common one would be to serialize the BO and save it to disk....once back in connection range (or in the office) then you can deserialize the BO and all of the unsaved content and call the Save just as you would any other time. 

Does version 1.6 provide some mechanism to save to a local datastore while the smart client is disconnected from ES?

Use the serialization methods on the BO:

Serialize to local file on disk

Dim loFile As New System.IO.FileStream("c:\temp\MyBO.ser", System.IO.FileMode.Create)
MyBO.SerializeToStream(loFile)

Restore a saved BO from disk

loFile = New System.IO.FileStream("c:\temp\MyBO.ser", System.IO.FileMode.Open)
MyBO = CType(MicroFour.StrataFrame.Business.BusinessLayer.DeserializeBusinessObject(loFile), MyBO)

By Lenard Dean - 3/5/2007

Hi Trent

So if a form had many BOs, one would have to manage each one of them separately, correct?  There is no top level "session" or "mechanism" that I could use to manage the saving/loading of the BOs while I was disconnected, right? 

Thanks.

--Lenard

By Trent L. Taylor - 3/5/2007

You could create a class to do this for you in about 10 minutes.  All forms already have a collection of business objects that have been dropped on it:

MyForm.BusinessObjects

You can pass this collection to a shared class that you create that cycles through the BOs and saves them to disk:

Public Class MyBOSaver
   Public Shared Sub SaveBOsToDisk(ByVal MyBOs As MicroFour.StrataFrame.Business.BusinessObjectCollection)
       '-- Cycle through all of the BOs
       For Each loBO As BusinessLayer IN MyBOs
          '-- Add the serialization code here...
       Next
    End Sub
End Class
By Larry Tucker - 3/9/2007

Trent,

Thanks for the reply.  Sounds like there are a lot of capabilities to "run disconnected".

Larry

By Trent L. Taylor - 3/9/2007

Glad to help, Larry Smile.  Yes, there are a number of different methods of which you can take advantage.