Implement Converter For Custom Value Mapping Set

In Data Exchange Framework, Sitecore items are only used for configuration. When a data synchronization process runs, the configuration is read from the Sitecore items and then converted into framework components.

Get Template Item Id

  1. In Sitecore, open Template Manager.
  2. Navigate to sitecore > templates > Data Exchange > Framework > Data Access > Mapping > Custom Value Mapping Set
../../../_images/selected-template.png
  1. Click the Content tab.
../../../_images/new-template-selected-new-icon.png
  1. In the Quick Info section, copy the Item ID value.
../../../_images/quick-info-section.png

Implement Class

A custom converter is needed to transform the Sitecore item that represents the custom value mapping set into an instance of your custom value mapping set type.

  1. In Visual Studio, add the following class:
using Sitecore.DataExchange;
using Sitecore.DataExchange.Attributes;
using Sitecore.DataExchange.Converters;
using Sitecore.DataExchange.Repositories;
using Sitecore.Services.Core.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Examples.DataExchange
{
    [SupportedIds("{73E9A7D8-33A0-4D28-8A97-1A49C7CFD3ED}")]
    public class CustomMappingSetConverter : BaseItemModelConverter<CustomMappingSet>
    {
        public CustomMappingSetConverter(IItemModelRepository repository) : base(repository)
        {
        }
        private static CustomMappingSet _instance = new CustomMappingSet();
        protected override ConvertResult<CustomMappingSet> ConvertSupportedItem(ItemModel source)
        {
            return ConvertResult<CustomMappingSet>.PositiveResult(_instance);
        }
    }
}

Note

Be sure to use the template item id from the previous step in the attribute SupportedIds.

Set Converter Type On Template

  1. In Sitecore, open Template Manager.
  2. Navigate to sitecore > templates > Data Exchange > Framework > Data Access > Mapping > Custom Value Mapping Set > __Standard Values
../../../_images/standard-values-item-selected.png
  1. Set the following field values:
Field Value
Converter Type Examples.DataExchange.CustomMappingSetConverter, Examples.DataExchange
  1. Save the item.