HowTo: Multiple Repositories scenario in a Mobile application

Official Content

This document explains how to use multiple repositories in a Mobile application and provides a brief overview about it.

Suppose there's a mobile application that connects to a different GAM - Repository, depending on the company of the user (multitenant scenario).

In this case, connection.gam (a server file containing all the GAM - Repository Connections) will have one GAM connection for each Repository in which the application is going to connect.

In general, applications of this kind have one Repository for each company, each with its own Repository Namespace. In order to allow users to connect to one Repository, the GAM Repository connection needs to be defined in the connection.gam file.

More information about the corresponding configuration issues is provided in Multiple Repository Scenario: The same application installation is shared by many companies

As for the program, the GAM connection has to be set programmatically before pointing the log in to the Repository that belongs to the user's company.

The connection can be set using the Repository property of the LoginExternalAdditionalParameters data type. The LoginExternalAdditionalParameters data type is used in the GAM Login Method to set some parameters. In particular, you can set the Repository you have to connect to.


Using the Repository property of LoginExternalAdditionalParameters data type

The LoginExternalAdditionalParameters object allows to set the Repository GUID where the connection is going to be set. It's the same as executing a Procedure where the SetConnection is executed. However, when using the Setconnection method, the connection name is used. In this case, the Repository GUID is used when the Repository property of LoginExternalAdditionalParameters data type is used. So, there must be at least one connection for this Repository in the connection.gam.

Event 'GXLogin'
        &LoginExternalAdditionalParameters.Repository = !"1e89a9ca-bc52-482b-a344-c4cda4a9cc8f"
        GeneXus.SD.Actions.Login(&User, &Password,&LoginExternalAdditionalParameters)

If the connection.gam has only one entry, the Repository parameter is ignored.