Azure Cosmos DB is accessed through an external Data Store of Service type.
The configuration settings of the data store must be as follows:
- Data store provider: CosmosDB
- Server Name : The connection string for your Cosmos DB extracted from the azure portal.
- Additional connection string attributes: It must include the following information separated by ";"
The Database and ApplicationRegion information is mandatory.
Another possible datastore configuration is as follows:
Here you set Additional connection string attributes for the value:
serviceURI=<connection string>;Database=<database name>;ApplicationRegion=<region>
The data store can be either created manually or by the Cosmos DB Inspector.
Go to the Azure portal and extract from there the connection string (to configure the "Server name" property of the data store).
The ApplicationRegion can be extracted from here:
The data model can be created automatically by the Cosmos DB Inspector, or you can create each transaction and its associated data view.
Given the Products transaction:
Define a data view with the Associated table property = Products, and the Datastore property = <datastore defined previously>.
Define the Service data store node:
For each attribute, define the mapping at CosmosDB with its External Name.
- The first attribute of the Primary Key must always be "id" because it should map with the Item id.
- The second attribute of the PK, if it exists, will be taken as the PartitionKey
The indexes defined in CosmosDB have to be mapped in the data view definition, as GeneXus uses that information at generation time.
Important: The indexes must have the Datastore of type service added at it's definition.
Generators: .NET, Java
As since GeneXus 18 Upgrade 3.