7. Implement Converter for Entity Repository TemplateΒΆ

A converter is needed to transform items created using the template from Add Template for Entity Repository into entity repository objects that can be used by Pipeline Step Processors.

  1. In Visual Studio, add the following class:
using Examples.DynamicsCrm.Repositories;
using Sitecore.Connect.Crm.DynamicsCrm.Repositories;
using Sitecore.DataExchange.Attributes;
using Sitecore.DataExchange.Converters;
using Sitecore.DataExchange.Providers.DynamicsCrm.Models.ItemModels.Repositories;
using Sitecore.DataExchange.Repositories;
using Sitecore.Services.Core.Model;
using System;

namespace Examples.DynamicsCrm.Converters
{
    [SupportedIds("[TEMPLATE-ID")]
    public class XrmClientAccountMembershipRepositoryConverter : BaseItemModelConverter<ItemModel, XrmClientEntityRepository>
    {
        public XrmClientAccountMembershipRepositoryConverter(IItemModelRepository repository) : base(repository)
        {
        }
        public override XrmClientEntityRepository Convert(ItemModel source)
        {
            if (!CanConvert(source))
            {
                return null;
            }
            var repository = new XrmClientAccountMembershipRepository(base.GetStringValue(source, EntityRepositoryItemModel.EntityName));
            return repository;
        }
    }
}
  1. Find the following line in the code:
[SupportedIds("[TEMPLATE-ID")]
  1. Replace [TEMPLATE-ID] with the ID for the template from Add Template for Entity Repository.
  2. Compile the project.
  3. Deploy Examples.DynamicsCrm.dll to your Sitecore server.