Working with Briefcases
February 12, 2013 in ROFX
One very useful feature of Data Abstract is Briefcase support. The Data Abstract briefcase provides local persistent storage. Simply store the data in a local briefcase file on the client file system, and the data can be reloaded without needing to request it again from the server.
Some common use cases:
- Use briefcase for saving client data including uncommitted changes between restarts of your application.
- Store some quite constant dictionary tables into briefcase and load them during application start and thus avoid having to reload the same data from the server.
- Request only the changed records for some huge table from the server side and then merge the delta with the client table loaded from the local briefcase.
- Use briefcases if you don’t have a persistent connection to your server and the user needs to be able to work in offline mode. Use Data Abstract’s robust conflict resolution to post the changes later.
In addition, a set of custom, application-specific string properties can be stored alongside the data. This can be useful, for example, for storing the version number of the data format to ensure newer versions of your application can reload the data correctly, if data formats change over time. (It is not recommended though to use this space for general application settings that are not directly related to the data.)
The main advantage of using a briefcase instead of some embedded database (f.e. SQLite.NET) to cache user data or to implement offline mode is that a briefcase stores not only user data but also its state (i.e. deleted, updated or inserted data rows). This greatly simplifies further synchronization with a Data Abstract-based server.
You can learn more about working with offline briefcases:
- Working with Offline Data in Briefcase files (.NET & Delphi)
- Briefcases Sample (Xcode, .NET & Delphi)
- Briefcase Explorer Sample (Delphi)
And more in the official RemObjects Documentation Wiki.
Stuart Clennett said on February 13, 2013
I think daBriefcase files are great. We use them for transferring data from one db to another, ad-hoc DB backups, letting users save snapshots to compare data over time, and general support purposes and for caching dictionary style data.
However, I have not as yet seen any example of using local file storage to support an offline application usage for any “real-world” application (that’s not a criticism of DA as it applies for all local storage). My app uses lots of server side methods, and without the server availability and no SQL capability the app just won’t run.
I use a Windows Server or WinCGI server against MSSQL whilst online. When the app goes offline I have had to use a DLL server** against an SQLite database. I use the excellent DABusinessProcessor on the server to intercept &record the changes in XML into an audit trail so I can replay them against the server when back online. So I still get server-side methods and SQL support when offline.
** all 3 server types are compiled from a single code-base