Skip to main content
Version: 8.0

EntityMapper class

Level: advanced

The Terrasoft.Configuration.EntityMapper class is a utility configuration class located in the FinAppLending package of the Lending product. EntityMapper lets you map data of one Entity to another according to the rules defined in the configuration file. Use this approach to avoid code monotony.

The Lending product has two objects that contain the same columns. These objects are Contact and AppForm. Also, several details of the Contact object are similar to details of the AppForm object. When filling out the app form, you might want to use the Id column of the Contact object to retrieve the list of all its columns and values, as well as required details with their columns and values, and map this data to the app form data. After that, Creatio can populate the app form fields using the mapped data. This helps to reduce the manual entry of the same data significantly.

The following classes implement the data mapping between different entities:

  • EntityMapper – implements the mapping logic.
  • EntityResult – defines the resulting type of the mapped entity.
  • MapConfig – a set of mapping rules.
  • DetailMapConfig – sets up a list of mapping rules for details and entities connected to them.
  • RelationEntityMapConfig – contains rules for mapping connected entities.
  • EntityFilterMap – a filter for database query.

EntityMapper class

The Terrasoft.Configuration namespace.

The class implements the mapping logic.

Methods

virtual EntityResult GetMappedEntity(Guid recId, MapConfig config)

Returns the mapped data for two Entity objects.

Parameters

recId

The GUID records in the database.

config

The instance of the MapConfig class, which is a set of mapping rules.

virtual Dictionary<string, object> GetColumnsValues(Guid recordId, MapConfig config, Dictionary<string, object> result)

Retrieves the main entity from the database and matches its columns and values according to the rules specified in the config object.

Parameters

recordId

The GUID records in the database.

config

The instance of the MapConfig class, which is a set of mapping rules.

result

The dictionary of columns and their values of the mapped entity.

virtual Dictionary<string, object> GetRelationEntityColumnsValues(List<RelationEntityMapConfig> relations, Dictionary<string, object> dictionaryToMerge, string columnName, Terrasoft.Nui.ServiceModel.DataContract.LookupColumnValue entitylookup)

Retrieves the bound entities from the database and matches them to the main entities.

Parameters

relations

The list of rules for retrieving bound records.

dictionaryToMerge

The dictionary of columns and their values.

columnName

The parent column name.

entitylookup

The object that contains the name and ID of the database record.

EntityResult class

The Terrasoft.Configuration namespace.

The class defines the resulting type of the mapped entity.

Properties

Columns Dictionary<string, object>

The dictionary of main entity column names and their values.

Details Dictionary<string, List<Dictionary<string, object>>>

The dictionary of detail names with the list of their columns and values.

MapConfig class

The Terrasoft.Configuration namespace.

The class is a set of mapping rules.

Properties

SourceEntityName string

The entity name in the database.

Columns Dictionary<string, object>

The dictionary with the names of columns of one entity and mapped columns of another entity.

DetailsConfig List<DetailMapConfig>

The list of configuration objects with rules for details.

CleanDetails List<string>

The list of detail names. Required to clean their values.

RelationEntities List<RelationEntityMapConfig>

The list of configuration objects with rules for mapping bound records to the main entity.

DetailMapConfig class

The Terrasoft.Configuration namespace.

The class sets up a list of mapping rules for the details and entities connected to them.

Properties

DetailName string

The detail name. Ensures the detail instance is unique.

SourceEntityName string

The entity name in the database.

Columns Dictionary<string, object>

The dictionary with the names of columns of one entity and mapped columns of another entity.

Filters List<EntityFilterMap>

The list of configuration objects with filtering rules for more accurate selections from the database.

RelationEntities List<RelationEntityMapConfig>

The list of configuration objects with rules for mapping bound records to the main entity.

RelationEntityMapConfig class

The Terrasoft.Configuration namespace.

The class contains rules for mapping connected entities.

Properties

ParentColumnName string

The parent column name. When Creatio finds the column the entity data retrieval and mapping logic activates.

SourceEntityName string

The entity name in the database.

Columns Dictionary<string, object>

The dictionary with the names of columns of one entity and mapped columns of another entity.

Filters List<EntityFilterMap>

The list of configuration objects with filtering rules for more accurate selections from the database.

RelationEntities List<RelationEntityMapConfig>

The list of configuration objects with rules for mapping bound records to the main entity.

EntityFilterMap class

The Terrasoft.Configuration namespace.

The class is a filter for database queries.

Properties

ColumnName string

The name of the column. When Creatio finds the column, the filtering logic activates.

Value object

The value to which to compare.