Salesforce

Caching Resources Locally (Magic xpa 4.x)

« Go Back

Information

 
Created BySalesforce Service User
Approval Process StatusPublished
Objective
Description

Caching Resources Locally (Magic xpa 4.x)

Offline Program Definition

For a program to work without server access, it must be specifically defined as an Offline program. An Offline program is downloaded to the client automatically on initial connection and kept cached at the client. Unlike non-Offline programs that are validated against the server on each invocation, Offline programs are always loaded from the client cache and do not require any server connectivity.

You define a Rich Client program as offline by checking the Offline check box in the Task Properties dialog box or the Program repository.

Note: For Offline programs defined in a component, the component must be defined as Load Immediate=Yes, so that the component’s Offline programs will also be downloaded to the client cache on initial connection.

Caching Application Resources

On initial connection to the server, all application-wide environment metadata (such as the Magic.ini file, color files, font files and so on), and application metadata (such as the Main Program and menus) are retrieved from the server and automatically saved to the client cache. These resources are automatically available to Offline programs.

Storing and Updating Data on the Client

Magic xpa provides a new database gateway, the Local gateway, for storing and accessing local data on RIA clients. This gateway is based on the SQLite database, and enables complete SQL access to local databases. Working with this database is similar to working with any other data source in Magic xpa, in that it can be used as a main or linked data source and supports the necessary data source operations.

A more detailed explanation on defining and working with a local data source can be found in the Local (Offline) Storage topic.

Caching User Credentials

When using integrated security, the user logon details and security credentials are automatically kept encrypted in the client cache. When running the application without connecting to the server, the last logon details (including rights) are used. Note that when running the application without connecting to the server, the logon dialog box will not appear. The logon credentials will be automatically synchronized on initial connection and on subsequent connected application startups.

Downloading Images for Offline Use

As in non-Offline programs, images can be defined to be read from the server or from the client. Some images are pre-defined to be read only from the server.

Images that are defined as server images are automatically downloaded, when connected, from the server to the client cache and then read from the cache. If the image does not exist in the client cache, it will be ignored and will not be displayed.

To make sure all images used in Offline programs are available when disconnected, you should copy, on initial startup, all server images that are used in Offline programs to the client using the ServerFileToClient() function. This function compares server and client file timestamps and will download new or updated server files to the client cache. Files that are unchanged will not be downloaded.

Downloading Third-Party .NET Assemblies (Windows Only)

Third-party .NET assemblies defined in the CRR will not be downloaded to the client automatically if used in an Offline program.

If your Offline programs use 3rd-party .NET assemblies, you should either install them on the client or use the ServerFileToClient() function to copy the assembly to the client on initial startup.

Reference
Attachment 
Attachment