Integration¶
Backend¶
Initial Configuration¶
First, reference the DataLoader Client Module in your Application
layer:
XML | |
---|---|
Define Entities¶
Before integrating the DataLoader in the respective Application Module
, you must define the entities that will represent your data.
Create three classes in the Application
layer:
Data Entity¶
Represents the raw structure of the file. Example:
C# | |
---|---|
Note
Both FileExtension
and TemplateProvider
are required by IDataEntity
. In this case, the example sets the extension as CSV, but it can be any other file extension. The other properties represent your actual entity data that will come from the file.
Data Loader¶
Converts the file data into the request type (the type of command/message you want to send). Example:
File Mapping¶
Defines how fields in the source file map to your entity properties. Example:
C# | |
---|---|
In this example, column index 0 in the file maps to Attribute1.
Add the DataLoader in Application Module¶
Once your entities and mappings are ready, register the DataLoader in the Application Module
.
Example:
This dependency can be explained in different parts:
AddDataLoaderFor<Entity, CreateOrUpdateEntity>(cfg => …)
: Creates and configures a newDataLoaderDescriptor
for the entity type (Entity) and the request type (CreateOrUpdateEntity).HasDataType<SuiteEntityData>()
: Registers the class that represents the incoming file data.Produces<EntityUpdated>()
: Defines the awaited response message produced when the data is processed.HandledBy<SuiteEntityDataLoader>()
: Assigns the transformer class that maps the file data to the request type.WithIdentifier()
: Defines the property used to uniquely identify records.WithBatchSize(int)
: Sets how many rows are processed per batch. By default the value is 20.
Configure Federation¶
Finally, expose the DataLoader service through your GraphQL federation setup:
C# | |
---|---|
This makes the DataLoader service accessible through the gateway, completing the backend integration.
Frontend¶
To enable the DataLoader feature in the UI you have to define a DataLoader action by using createDataLoaderAction
.
Example:
TypeScript | |
---|---|
Then, bind said action to the entity list by using enableDataLoader
.
Example: