Official Content

Azure Cosmos DB is accessed through an external Data Store of Service type.

Summary

Connection configuration

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 ";"

    Database=<>;ApplicationRegion=<>

The Database and ApplicationRegion information is mandatory.

image_2023110132343_1_png

The data store can be either created manually or by the Cosmos DB Inspector.

Where to get the connection information

Go to the Azure portal and extract from there the connection string (to configure the "Server name" property of the data store). 

image_2022121721049_1_png

The ApplicationRegion can be extracted from here:

image_20221218105350_1_png

Data model

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:

image_2022112811332_1_png

Define a data view with the Associated table property = Products, and the Datastore property = <datastore defined previously>.

image_2022112811538_1_png

Define the Service data store node:

image_2022112811652_1_png

For each attribute, define the mapping at CosmosDB with its External Name.

Important:

  • 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


image_2022112811747_1_png

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.

image_20221128162156_1_png

Scope

Generators: .NETJava

Availability

As since GeneXus 18 Upgrade 3.

 

Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant